How to restore terminal after curses program crashes?

Michael Meissner meissner at osf.org
Mon Feb 18 09:00:24 AEST 1991


In article <1991Feb17.164719.17328 at IRO.UMontreal.CA>
babin at IRO.UMontreal.CA (Gilbert Babin) writes:

| I have the same problem with AIX, but whenever I type a character (any one)
| after the crash, the shell goes into an infinite loop.
| 
| Any ideas on how to solve that on AIX?

When debugging applications like the above, I typically invoke it via:

	nethack; reset_tty

where reset_tty is my shell script to reset all terminal modes to
normal values.  For most people, you can do:

	stty sane
	stty dec

(stty dec resets some things that sane does).  In case you are
curious, here is my reset_tty shell script (I have 3 environment
variables set in my .profile depending on what system I'm on --
ATT_STTY, OSF1_STTY, and BSD_STTY):

#! /bin/sh


if [ "$ATT_STTY" != "" ]; then
	stty			\
		erase	"^?"	\
		kill	"^u"	\
		intr	"^c"	\
		quit	"^\\"	\
		eof	"^d"	\
		eol	"^-"	\
		swtch	"^z"	\
		isig		\
		icanon		\
		istrip		\
		echoe		\
		echok		\
		ignbrk		\
		opost		\
		ixon		\
		ixoff		\
		-ixany		\
		-echonl		\
		-onlret		\
		-xcase

	if [ "${EMACS}" = "t" -o "${EMACS_KLUDGE}" = "t" ]; then
		stty -echo onlret
	fi

elif [ "$OSF1_STTY" != "" ]; then
	stty			\
		erase	"^?"	\
		kill	"^u"	\
		intr	"^c"	\
		quit	"^\\"	\
		eof	"^d"	\
		eol	"^-"	\
		rprnt	"^r"	\
		flush	"^o"	\
		werase	"^w"	\
		lnext	"^v"	\
		susp	"^z"	\
		dsusp	"^^"	\
		isig		\
		icanon		\
		istrip		\
		echoe		\
		echok		\
		ignbrk		\
		opost		\
		ixon		\
		ixoff		\
		-ixany		\
		-echonl		\
		-onlcr

	if [ "${EMACS}" = "t" -o "${EMACS_KLUDGE}" = "t" ]; then
		stty -echo onlcr
	fi
else
	stty	new
	stty	erase	"^?"	\
		kill	"^u"	\
		intr	"^c"	\
		quit	"^\\"	\
		start	"^q"	\
		stop	"^s"	\
		eof	"^d"	\
		rprnt	"^r"	\
		flush	"^o"	\
		werase	"^w"	\
		lnext	"^v"	\
		susp	"^z"	\
		dsusp	"^^"	\
		cooked		\
		cr0		\
		crtbs		\
		crterase	\
		crtkill		\
		ctlecho		\
		decctlq		\
		echo		\
		even		\
		ff0		\
		-lcase		\
		-litout		\
		-nl		\
		nl0		\
		-noflsh		\
		-nohang		\
		odd		\
		pass8		\
		-prterase	\
		-tabs		\
		tandem		\
		-tilde		\
		-tostop

	if [ "${EMACS}" = "t" -o "${EMACS_KLUDGE}" = "t" ]; then
		stty -echo nl
	fi
fi
--
Michael Meissner	email: meissner at osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

Considering the flames and intolerance, shouldn't USENET be spelled ABUSENET?



More information about the Comp.unix.programmer mailing list