|
|
1.1 ! root 1: #include <signal.h> ! 2: #include <errno.h> ! 3: ! 4: extern int (*_signal())(); ! 5: extern int _sigtramp(); ! 6: int (*_sigfunc[NSIG])(); ! 7: extern int errno; ! 8: ! 9: int (*signal(sig, func))() ! 10: int sig; ! 11: int (*func)(); ! 12: { ! 13: int (*ofunc)(); ! 14: ! 15: if (sig <= 0 || sig >= NSIG) { ! 16: errno = EINVAL; ! 17: return (BADSIG); ! 18: } ! 19: ofunc = _sigfunc[sig]; ! 20: _sigfunc[sig] = func; ! 21: if (func != SIG_DFL && func != SIG_IGN) ! 22: func = _sigtramp; ! 23: if (_signal(sig, func) == BADSIG ) { ! 24: _sigfunc[sig] = ofunc; ! 25: return (BADSIG); ! 26: } ! 27: return(ofunc); ! 28: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.