Xref: utzoo comp.unix.programmer:1093 comp.unix.questions:28779 Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!usc!jarthur!ucivax!orion.oac.uci.edu!ucsd!nosc!humu!pegasus!pilikia!art From: art@pilikia.pegasus.com (Art Neilson) Newsgroups: comp.unix.programmer,comp.unix.questions Subject: Re: How to restore terminal after curses program crashes? Keywords: curses,cbreak,terminal Message-ID: <1991Feb16.205808.4337@pilikia.pegasus.com> Date: 16 Feb 91 20:58:08 GMT References: <1991Feb13.133332.22320@ousrvr.oulu.fi> Organization: Pilikia, Honolulu Lines: 18 In article <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 :-). The best way to handle this is to trap signals in the C program which uses curses and have the signal handler call endwin() prior to exiting. -- Arthur W. Neilson III | INET: art@pilikia.pegasus.com Bank of Hawaii Tech Support | UUCP: uunet!ucsd!nosc!pegasus!pilikia!art