Catching ^C and ^Z
Neil Weisenfeld
weisen at eniac.seas.upenn.edu
Wed Sep 5 13:55:20 AEST 1990
In article <Sep.4.20.08.17.1990.1216 at utopia.rutgers.edu>, deen at utopia (Cinnamon Raisin) writes:
>
>Hi boys and girls,
>
> I am trying to write a quick programme to lock a terminal(TTY)
> when I leave it. Essentially I want to capture all the
> interrupts that can be sent from the keyboard, such as
> SIG_INT,SIG_QUIT and so on. The only reasonable thing I've
> found that lets me do this is ioctl().
[stuff deleted]
I remember doing this a while ago. What UNIX are you running? Under BSD,
you should be able to do something like:
signal(SIGINT,SIG_IGN);
signal(SIGQUIT,SIG_IGN);
to IGNore the signals. Using SIG_DFL should return them to their default
handlers. You can also substitute a pointer to a handler of your own. Take
a look at signal(3) and sigvec(2).
Neil
_____________________________________________________________________________
( ) _ ( ) Neil Weisenfeld | 3900 Chestnut St.
( )(_)_ ( ) Computer Science and Engineering | Apt. 233
( ) (_)_ ( ) School of Engineering and Applied Science | Philadelphia, PA
( ) (_)( ) University of Pennsylvania | 19104
(_) (_) Class of 1991 |
-----------------------------------------------------------------------------
--
_____________________________________________________________________________
( ) _ ( ) Neil Weisenfeld | 3900 Chestnut St.
( )(_)_ ( ) Computer Science and Engineering | Apt. 233
( ) (_)_ ( ) School of Engineering and Applied Science | Philadelphia, PA
More information about the Comp.lang.c
mailing list