Ignore <Ctrl-D>

Daniel Brahneborg dvldbg at cs.umu.se
Mon Mar 25 11:15:38 AEST 1991


>I'm doing a menu in C, and trying to ignore <Ctrl-d> <Ctrl-c> <Ctrl-z> etc. 
>In other words, I would like the program not to be interrupted until user
>select 'Quit' from the menu. (If I press <Ctrl-d> 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.

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.

Send a mail if it doesn't work, and I'll see what I can do to help you.

/Basic



More information about the Comp.unix.programmer mailing list