home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume4
/
gnumacs-blit
/
part01
/
5620m
/
5620mtset
< prev
next >
Wrap
Text File
|
1989-02-03
|
2KB
|
81 lines
#!/bin/sh
# 5620mtset Gernot Heiser (heiser@iis.uucp) 1988-07-16
#
# This program writes to the standard output the commands required to
# correctly set the terminal environment in a 5620m layer. The program
# should therefore be installed on all machines, not only the ones
# where mux is installed.
#
# The normal (interactive) use, e.g. to set TERMCAP after an rlogin,
# is
# eval `5620mtset`
# Note that csh users must
# set noglob
# first.
#
# The -f option is used by 5620m to initially setup the terminal in
# the layer. It causes the terminal to be reverted from a funny mux
# state to usual settings (echo, crt). The latter is done by the
# program `5620mstty'. Note that the -f option is only needed for
# initial setup, therefore `5620mstty' needs only to be installed
# where mux is installed.
#
# The -c and -s options force the commands to be in /bin/csh or
# /bin/sh format respectively. This is useful in shell scripts
# executed by a shell other than the user's default shell.
#
# Warning: This program is rather tricky and, after lots of trial and
# error, appears to be working now. Don't change it, unless you are
# sure to know what you are doing!!!
#
export SHELL
fixtty=no
while true; do
case $1 in
-c) SHELL=/bin/csh
shift;;
-f) fixtty=yes
shift;;
-s) SHELL=/bin/sh
shift;;
*) break;;
esac
done
if [ $# != 0 ]; then
echo usage: eval \`$0 [-c -e -f -s]\` 1>&2
exit 1
fi
if [ $fixtty != "yes" ]; then
stty -echo > /dev/tty
fi
echo -n "[?C" > /dev/tty
cmd=
read temp
while true; do
case $temp in
\[\?[0-9]*\;[0-9]*C)
break;;
*)
cmd="${cmd};$temp"
read temp ;;
esac
done
size="`echo $temp | \
sed -e 's/\[?\([0-9][0-9]*\);\([0-9][0-9]*\)C/co#\2:li#\1/`"
tset -s -Q 5620x | sed -e "s/co#[0-9][0-9]*:li#[0-9][0-9]*/${size}/"
if [ "$cmd" != "" ]; then
echo "$cmd"
fi
if [ $fixtty = "yes" ]; then
5620mstty
fi
stty echo crt > /dev/tty