Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!ai-lab!gnu.ai.mit.edu!goehring From: goehring@gnu.ai.mit.edu (Not Marc Spencer) Newsgroups: comp.unix.programmer Subject: Re: Ignore Message-ID: Date: 25 Mar 91 19:46:02 GMT References: <1991Mar25.011538.11226@cs.umu.se> Sender: news@ai.mit.edu Reply-To: goehring@gnu.ai.mit.edu Distribution: comp.unix.programmer Organization: Department of Tautological Pleonasms and Superfluous Redundancies Department Lines: 27 In-reply-to: dvldbg@cs.umu.se's message of 25 Mar 91 01:15:38 GMT In article <1991Mar25.011538.11226@cs.umu.se> dvldbg@cs.umu.se (Daniel Brahneborg) writes: >I'm doing a menu in C, and trying to ignore > etc. In other words, I would like the program not to be >interrupted until user select 'Quit' from the menu. (If I press > when the program is waiting for user to select the menu, >the program will go to infinite loop) There are as far as I know two ways of doing this. The easiest way is to use the signal(3) call, or maybe the underlying system call, and tell it to ignore SIGSUSP, SIGINTR, SIGTERM, and a few others. Or if you prefer, call one of your own routines. this won't help, much. at the very least even if you do catch sigint it will still abort any i/o in progress. The other way is to manupulate the terminal handler, which sends the above mentioned signals. By calling ioctl(), you can set a lot of things, which I leave you to discover for yourself. this will. he needs to put the terminal into raw mode if he wants the terminal handler not to produce signals, which is imho infinitely better than trying to catch all those signals. -- Help stamp out vi in our lifetime! Scott Goehring goehring@gnu.ai.mit.edu On exile in Indianapolis, IN