[LCP] Terminating signals to handle

Christopher Howard choward at indicium.us
Wed Jan 14 17:32:06 EST 2009


I'm writing an ncurses app in C (my first C app, actually). The terminal 
mode is set to raw, so the app shouldn't reason the SIGINT signal (well, I 
guess not anyway...) But a friend of mine looked at the code and told me I 
should have a function that handles terminating signals, to make sure that 
the terminal is returned to a normal state if someone kills the program 
externally.

Here are my questions: Which signals should I bother handling? I see in 
the signal(7) man page here that there are something like twenty signals 
that can be received. SIGHUP, SIGKILL, SIGTERM, and SIGSTOP seem relevant 
for the aforementioned purpose...

Secondly: Can the signal function in signal.h be used to direct more than 
one kind of signal to the same function? (Rather than a separate function 
for each signal?)

-- 
Christopher Howard
http://indicium.us



More information about the linuxCprogramming mailing list