Catching ^C and ^Z

Mark A Terribile mat at mole-end.UUCP
Sat Sep 8 15:30:00 AEST 1990


> > [I wanna write a lockscreen.]
 
> weisen at eniac.seas.upenn.edu:
> > Under BSD, you should be able to do something like:
> >        signal(SIGINT,SIG_IGN);
> >        signal(SIGQUIT,SIG_IGN);
> > to IGNore the signals.
 
> SunOS signal(3):
> > SIGKILL   9    kill (cannot be caught, blocked, or ignored)
> > SIGSTOP   17   stop (cannot be caught, blocked, or ignored)
 
> Therein lies the incentive to capture the characters before a shell can see
> them.

Well, if you are under SunOS you already have a very nice lockscreen, at
least in all the windowing environments.

BUT

^C does NOT generate a SIGKILL, it generates a SIGINT (or does SunOS still
call it a SIGDEL ?)  That certainly CAN be caught or ignored.  To prevent
being SIGSTOPped, you read the terminal modes ( ioctl() ) to determine the
present stop character, SET the stop character to NUL (thereby disabling
the feature) and RESTORE the stop character before you go away.

This is really a Unix/Berzerkelix/SunOS question, you know ...
-- 

 (This man's opinions are his own.)
 From mole-end				Mark Terribile



More information about the Comp.lang.c mailing list