How to restore terminal after curses program crashes?

Andy Behrens mjm at eleazar.dartmouth.edu
Fri Feb 15 06:29:59 AEST 1991


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).  
>
> Does anyone know how to restore the terminal to a sane state?
> So far, the only thing that has worked for me is the power switch :-).

The 'reset' command will do this.  However, since curses has probably
left your terminal in raw mode, carriage return is no longer considered
to be an end-of-line character -- you'll have to use a newline instead.

Typing

	ctrl-J reset ctrl-J

should fix everything.  If you've changed your kill characters, it will
be reset to a default value, so you might want to set it again with
'stty'.

Andy



More information about the Comp.unix.questions mailing list