scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

signal.c (249B)


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