#include <signal.h> void ( *signal( int signal, void (* func) (int)) ) (int);
The signal() function sets func to be called when signal is recieved by your program. func can be a custom signal handler, or one of these macros (defined in signal.h):
Macro | Explanation |
---|---|
SIG_DFL | default signal handling |
SIG_IGN | ignore the signal |
The return value of signal() is the address of the previously defined function for this signal, or SIG_ERR is there is an error.