diff options
author | Jim Meyering <jim@meyering.net> | 1998-08-11 18:40:21 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-08-11 18:40:21 +0000 |
commit | ba36aa0602bfcd5f739e20bed4a6beb2435edf99 (patch) | |
tree | 55b7958d5ce9f7cae9e7ce1f2d1bb50f557f65b7 /tests/stty | |
parent | 58a54666a7809cc2ddbccc55ff2db622c563a966 (diff) | |
download | coreutils-ba36aa0602bfcd5f739e20bed4a6beb2435edf99.tar.xz |
*** empty log message ***
Diffstat (limited to 'tests/stty')
-rwxr-xr-x | tests/stty/simple-1 | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/tests/stty/simple-1 b/tests/stty/simple-1 index dfdc880f3..cd5471b01 100755 --- a/tests/stty/simple-1 +++ b/tests/stty/simple-1 @@ -1,6 +1,25 @@ #! /bin/sh # Make sure stty can parse most of its options. +reversible () +{ + case $1 in + # The following list of reversible options was generated with + # grep -w REV stty.c |grep '{"' |sed 's/....//;s/".*//' \ + # |fmt |tr ' ' '|' |sed 's/$/) ;;/' + parenb|parodd|hupcl|hup|cstopb|cread|clocal|crtscts|ignbrk|brkint|ignpar) ;; + parmrk|inpck|istrip|inlcr|igncr|icrnl|ixon|ixoff|tandem|iuclc|ixany) ;; + imaxbel|opost|olcuc|ocrnl|onlcr|onocr|onlret|ofill|ofdel|isig|icanon) ;; + iexten|echo|echoe|crterase|echok|echonl|noflsh|xcase|tostop|echoprt) ;; + prterase|echoctl|ctlecho|echoke|crtkill|evenp|parity|oddp|nl|cooked|raw) ;; + pass8|litout|cbreak|decctlq|tabs|lcase|LCASE) ;; + + *) echo no; return;; + esac + + echo yes; +} + : ${STTY=stty} if test "$VERBOSE" = yes; then @@ -19,22 +38,30 @@ options=`stty -a|tail +2|tr ';' '\012'|sed '/ = /d;s/^ //'|tr -s ' -' '\012'` # Take them one at a time, with and without the leading `-'. for opt in $options; do $STTY $opt || exit 1 - case $opt in - # The following list of reversible options was generated with - # grep -w REV stty.c|grep '{"'|sed 's/....//;s/".*//'|fmt \ - # |tr ' ' '|'|sed 's/$/) ;;/' - parenb|parodd|hupcl|hup|cstopb|cread|clocal|crtscts|ignbrk|brkint|ignpar) ;; - parmrk|inpck|istrip|inlcr|igncr|icrnl|ixon|ixoff|tandem|iuclc|ixany) ;; - imaxbel|opost|olcuc|ocrnl|onlcr|onocr|onlret|ofill|ofdel|isig|icanon) ;; - iexten|echo|echoe|crterase|echok|echonl|noflsh|xcase|tostop|echoprt) ;; - prterase|echoctl|ctlecho|echoke|crtkill|evenp|parity|oddp|nl|cooked|raw) ;; - pass8|litout|cbreak|decctlq|tabs|lcase|LCASE) ;; - *) # Skip options that aren't reversible. - continue;; - esac - $STTY -$opt || exit 1 + if test `reversible $opt` = yes; then + $STTY -$opt || exit 1 + fi done -# grep -w REV stty.c|grep '{"'|sed 's/....//;s/".*//' +# Take them in pairs. +for opt1 in $options; do + echo .|tr -d '\012' + for opt2 in $options; do + + $STTY $opt1 $opt2 || exit 1 + + test `reversible $opt1` = yes && rev1=yes || rev1=no + test `reversible $opt2` = yes && rev2=yes || rev2=no + if test $rev1 = yes; then + $STTY -$opt1 $opt2 || exit 1 + fi + if test $rev2 = yes; then + $STTY $opt1 -$opt2 || exit 1 + fi + if test "$rev1$rev2" = yesyes; then + $STTY -$opt1 -$opt2 || exit 1 + fi + done +done exit 0 |