6 * Calling signal() is non-portable, as it varies in meaning
7 * between platforms and depending on feature macros, and has
8 * stupid semantics at least some of the time.
10 * This function provides the same interface as the libc function,
11 * but provides consistent semantics. It assumes POSIX semantics
12 * for sigaction() (so you might need to do some more work if you
13 * port to something ancient like SunOS 4)
15 void (*putty_signal(int sig, void (*func)(int)))(int) {
20 if(sigemptyset(&sa.sa_mask) < 0)
22 sa.sa_flags = SA_RESTART;
23 if(sigaction(sig, &sa, &old) < 0)
25 return old.sa_handler;
28 void block_signal(int sig, int block_it)
34 if(sigprocmask(block_it ? SIG_BLOCK : SIG_UNBLOCK, &ss, 0) < 0) {
35 perror("sigprocmask");