Microport console driver & raw mode programs

Stephen J. Friedl friedl at vsi.UUCP
Mon Apr 11 03:35:30 AEST 1988


In article <128 at obie.UUCP>, wes at obie.UUCP (Barnacle Wes) writes:
> It could be that elm is not restoring your stty settings correctly.  I
> have a simple csh alias that takes care of this problem, which is
> especially frequent in my own programs:  :-)
> 
> alias oops 'stty sane erase \^h intr \^c kill \^y echoe ixany ; stty'
> 
> This restores my stty settings (at least the ones that seem to get
> garbled the most) and then prints them on the screen.

Alternate generic way to reset your favorite tty settings: "stty -g"
outputs a string of the current stats that you can't read but stty can.

	$ stty -g
	d26:5:dad:3b:7f:1c:8:15:4:0:0:0

It turns out that it maps directly to |struct termio| fields,
but you don't need to pay attention to the specifics.  Now,
set this string in your .profile after setting your favorite
stty modes:

	STTYMODES=`stty -g` ; export STTYMODES    # save tty modes

Now `oops' (I call it `reset') can be a shell script that does:

	if [ "$STTYMODES" ] ; then
		stty $STTYMODES
	else
		stty sane erase '^h' intr '^c' kill '^y' echoe ixany
	fi
	stty

If you have saved your tty modes, they are restored, otherwise you
get some hopefully reasonable defaults.

-- 
Steve Friedl   V-Systems, Inc.   "Yes, I'm jeff at unh's brother"
friedl at vsi.com  {backbones}!vsi.com!friedl  attmail!vsi!friedl



More information about the Comp.unix.questions mailing list