(jm_FILE_SYSTEM_USAGE): Open-code what was a use of AS_IF.
[coreutils.git] / tests / stty / row-col-1
bloba8ecb8d806cc5a8bca7b15508b0c03f0af0f5fcc
1 #! /bin/sh
2 # This script takes no arguments.
4 if test "$VERBOSE" = yes; then
5 set -x
6 stty --version
7 fi
9 # Setting this envvar to a very small value used to cause e.g., `stty size'
10 # to generate slightly different output on certain systems.
11 COLUMNS=80
12 export COLUMNS
14 # Make sure there's a tty on stdin.
15 . $srcdir/input-tty
17 # Versions of GNU stty from shellutils-1.9.2c and earlier failed
18 # tests #2 and #4 when run on SunOS 4.1.3.
20 tests='
21 1 rows_40_columns_80 40_80
22 2 rows_0_columns_0 0_0
23 3 rows_40_columns_80 40_80
24 4 rows_0 0_80
25 5 columns_0 0_0
26 6 rows_40 40_0
27 7 rows_0 0_0
28 8 columns_80 0_80
29 9 rows_30 30_80
30 NA LAST NA
32 set - $tests
34 saved_size=.saved-size
36 stty size > $saved_size || exit 1
38 fail=0
39 while :; do
40 test_name=$1
41 args=$2
42 expected_result="`echo $3|tr _ ' '`"
43 test "$args" = empty && args=''
44 test "x$args" = xLAST && break
45 args=`echo x$args|tr _ ' '|sed 's/^x//'`
46 if test "$VERBOSE" = yes; then
47 # echo "testing \`stty $args; stty size\` = $expected_result ..."
48 echo "test $test_name... " | tr -d '\012'
50 stty $args || exit 1
51 test x"`stty size 2> /dev/null`" = "x$expected_result" \
52 && ok=ok || ok=FAIL fail=1
53 test "$VERBOSE" = yes && echo $ok
54 shift; shift; shift
55 done
57 stty `cat $saved_size|sed 's/ / columns /;s/^/rows /'` || exit 1
58 rm -f $saved_size
60 exit $fail