6 * Calling signal() is a non-portable, as it varies in meaning between
7 * platforms and depending on feature macros, and has stupid semantics
8 * at least some of the time.
10 * This function provides the same interface as the libc function, but
11 * provides consistent semantics. It assumes POSIX semantics for
12 * sigaction() (so you might need to do some more work if you port to
13 * 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");