signal.c (260B)
1 #include <stddef.h> 2 #include <signal.h> 3 #include <sys.h> 4 #undef signal 5 6 void 7 (*signal(int signum, void (*func)(int)))(int) 8 { 9 struct sigaction sa = { 10 .sa_handler = func, 11 }; 12 13 if (_sigaction(signum, &sa, &sa) < 0) 14 return SIG_ERR; 15 16 return sa.sa_handler; 17 }