| 1 | /* |
| 2 | char id_signal[] = "@(#)signal_.c 1.1"; |
| 3 | * |
| 4 | * change the action for a specified signal |
| 5 | * |
| 6 | * calling sequence: |
| 7 | * integer cursig, signal, savsig |
| 8 | * external proc |
| 9 | * cursig = signal(signum, proc, flag) |
| 10 | * where: |
| 11 | * 'cursig' will receive the current value of signal(2) |
| 12 | * 'signum' must be in the range 0 <= signum <= 16 |
| 13 | * |
| 14 | * If 'flag' is negative, 'proc' must be an external proceedure name. |
| 15 | * |
| 16 | * If 'flag' is 0 or positive, it will be passed to signal(2) as the |
| 17 | * signal action flag. 0 resets the default action; 1 sets 'ignore'. |
| 18 | * 'flag' may be the value returned from a previous call to signal. |
| 19 | */ |
| 20 | |
| 21 | #include "../libI77/f_errno.h" |
| 22 | |
| 23 | /*** NOTE: the type casts for procp and signal are problematical but work ***/ |
| 24 | int (*signal())(); |
| 25 | |
| 26 | long signal_(sigp, procp, flag) |
| 27 | long *sigp, *flag; |
| 28 | int (*procp)(); |
| 29 | { |
| 30 | if (*sigp < 0 || *sigp > 16) |
| 31 | return(-((long)(errno=F_ERARG))); |
| 32 | |
| 33 | if (*flag < 0) /* function address passed */ |
| 34 | return((long)signal((int)*sigp, procp) ); |
| 35 | |
| 36 | else /* integer value passed */ |
| 37 | return((long)signal((int)*sigp, (int)*flag) ); |
| 38 | } |