How to restore terminal after curses program crashes?

uunet!bria!mike uunet!bria!mike
Thu Feb 14 18:03:22 AEST 1991


In an article, clegg at tolsun.oulu.fi (Matthew Tran Clegg/VTT) writes:
>I've been working on a program that uses the curses package and
>cbreak mode.  Once in a while, a bug will cause the program to
>crash (for example, with a segmentation fault).  This completely
>unhinges the terminal.  It won't respond to anything anymore,
>except if I press ^C, then the csh prompt will be printed.

When your terminal is in a good mood, enter the following command:

	stty -g >$HOME/.stty

Then, put an alias in your $HOME/.profile (or whatever), such as:

	sane() stty `cat $HOME/.stty`

Obviously this is for the Bourne shell; translate as appropriate for
csh, or whatever you prefer to use. 

So, when nethack bites the dust, you enter:

	$ sane^J

This will restore your terminal exactly the way it was when you first
entered the 'stty -g' command.
-- 
Michael Stefanik                       | Opinions stated are not even my own.
Systems Engineer, Briareus Corporation | UUCP: ...!uunet!bria!mike
-------------------------------------------------------------------------------
technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly
found to be saying things like "Well, it works on my DOS machine ..."



More information about the Comp.unix.programmer mailing list