mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-18 01:40:06 +02:00
68 lines
1.8 KiB
Bash
Executable File
68 lines
1.8 KiB
Bash
Executable File
#! /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
|
|
set -x
|
|
$RM --version
|
|
fi
|
|
|
|
saved_state=.saved-state
|
|
$STTY --save > $saved_state || exit 1
|
|
trap "status=$?; $STTY `cat $saved_state`; exit $status" 0 1 2 3 15
|
|
$STTY `cat $saved_state` || exit 1
|
|
|
|
# Build a list of all boolean options stty accepts on this system.
|
|
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
|
|
if test `reversible $opt` = yes; then
|
|
$STTY -$opt || exit 1
|
|
fi
|
|
done
|
|
|
|
# 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
|