Xref: utzoo comp.unix.programmer:1103 comp.unix.questions:28799 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!sdd.hp.com!uakari.primate.wisc.edu!dali.cs.montana.edu!milton!sumax!quick!thebes!camco!bill From: bill@camco.Celestial.COM (Bill Campbell) Newsgroups: comp.unix.programmer,comp.unix.questions Subject: Re: How to restore terminal after curses program crashes? Keywords: curses,cbreak,terminal Message-ID: <725@camco.Celestial.COM> Date: 18 Feb 91 18:56:40 GMT References: <1991Feb13.133332.22320@ousrvr.oulu.fi> Followup-To: comp.unix.programmer Organization: Celestial Software, Mercer Island, WA Lines: 34 In <1991Feb13.133332.22320@ousrvr.oulu.fi> clegg@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. >(I've noticed sometimes that nethack will crash in this way too, but >only when the game is better than any I've had in months -- a real bummer.) >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 :-). >Matthew Clegg >clegg@tolsun.oulu.fi, February 13 I set an environment variable in my .login (.profile for /bin/sh users) setenv NORMTTY `stty -g` This extracts the stty parameters in a form suitable as an argument to stty so all I have to do is type: ^Jstty $NORMTTY^J where ^J is control-j. This resets the terminal to your login state. Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software UUCP: ...!thebes!camco!bill 6641 East Mercer Way uunet!camco!bill Mercer Island, WA 98040; (206) 947-5591