Allows you to specify the way in which the signal sig is to be handled: use the default handling for the signal, ignore the signal, or call the signal handler at the address specified. Format #include <signal.h> void (*signal (int sig, void (*func) (int))) (int);
1 – Arguments
sig The number or mnemonic associated with a signal. This argument is usually one of the mnemonics defined in the <signal.h> header file. func Either the action to take when the signal is raised, or the address of a function needed to handle the signal.
2 – Description
If func is the constant SIG_DFL, the action for the given signal is reset to the default action, which is to terminate the receiving process. If the argument is SIG_IGN, the signal is ignored. Not all signals can be ignored. If func is neither SIG_DFL nor SIG_IGN, it specifies the address of a signal-handling function. When the signal is raised, the addressed function is called with sig as its argument. When the addressed function returns, the interrupted process continues at the point of interruption. (This is called catching a signal. Signals are reset to SIG_DFL after they are intercepted, except as shown in the Error and Signal Handling chapter of the HP C RTL Reference Manual. You must call the signal function each time you want to catch a signal. See the "Error and Signal Handling" chapter of the HP C RTL Reference Manual for more information on signal handling. To cause an OpenVMS exception or a signal to generate a UNIX style signal, OpenVMS condition handlers must return SS$_RESIGNAL upon receiving any exception that they do not want to handle. Returning SS$_CONTINUE prevents the correct generation of a UNIX style signal.
3 – Return Values
x The address of the function previously established to handle the signal. SIG_ERR Indicates that the sig argument is out of range.