.TH SIGNAL 3F .UC .SH NAME signal \- change the action for a signal .SH SYNOPSIS .B integer function signal(signum, proc, flag) .br .B integer signum, flag .br .B external proc .SH DESCRIPTION When a process incurs a signal (see .IR signal (2)) the default action is usually to clean up and abort. The user may choose to write an alternative signal handling routine. A call to .I signal is the way this alternate action is specified to the system. .PP .I Signum is the signal number (see .IR signal (2)). If .I flag is negative, then .I proc must be the name of the user signal handling routine. If .I flag is zero or positive, then .I proc is ignored and the value of .I flag is passed to the system as the signal action definition. In particular, this is how previously saved signal actions can be restored. Two possible values for .I flag have specific meanings: 0 means "use the default action" (See NOTES below), 1 means "ignore this signal". .PP A positive returned value is the previous action definition. A value greater than 1 is the address of a routine that was to have been called on occurance of the given signal. The returned value can be used in subsequent calls to .I signal in order to restore a previous action definition. A negative returned value is the negation of a system error code. (See .IR perror (3F)) .SH FILES /usr/lib/libU77.a .SH "SEE ALSO" kill(1), signal(2), kill(3F) .SH NOTES .B f77 arranges to trap certain signals when a process is started. The only way to restore the default .B f77 action is to save the returned value from the first call to .I signal. .PP When a user signal handling routine is called, UNIX resets the signal action definition to its original default value. Thus it is necessary to call .IR signal (3F) from within the user signal handler in order to catch subsequent occurrances of the same signal. See .IR signal (2) for a fuller explanation. .PP If the user signal handler is called, it will be passed the signal number as an integer argument.