2 # Test "stty" with rows and columns.
4 # Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free
5 # Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 # This script takes no arguments.
25 if test "$VERBOSE" = yes; then
30 # Setting this envvar to a very small value used to cause e.g., `stty size'
31 # to generate slightly different output on certain systems.
35 # Make sure we get English-language behavior.
36 # See the report about a possibly-related Solaris problem by Alexandre Peshansky
37 # <http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00035.html>.
38 # Currently stty isn't localized, but it might be in the future.
42 # Make sure there's a tty on stdin.
43 . $srcdir/../input-tty
45 # Versions of GNU stty from shellutils-1.9.2c and earlier failed
46 # tests #2 and #4 when run on SunOS 4.1.3.
49 1 rows_40_columns_80 40_80
50 2 rows_1_columns_1 1_1
51 3 rows_40_columns_80 40_80
62 saved_size=`stty size` && test -n "$saved_size" \
63 || { echo "$0: skipping this test: can't get window size" 1>&2;
70 expected_result="`echo $3|tr _ ' '`"
71 test "$args" = empty && args=''
72 test "x$args" = xLAST && break
73 args=`echo x$args|tr _ ' '|sed 's/^x//'`
74 if test "$VERBOSE" = yes; then
75 # echo "testing \`stty $args; stty size\` = $expected_result ..."
76 echo "test $test_name... " | tr -d '\n'
79 test x"`stty size 2> /dev/null`" = "x$expected_result" \
80 && ok=ok || ok=FAIL fail=1
81 test "$VERBOSE" = yes && echo $ok
86 stty rows $2 columns $3 || exit 1