| 586 | } |
| 587 | |
| 588 | void |
| 589 | sethanguphandler(void (*handler)(int)) |
| 590 | { |
| 591 | #ifdef SA_RESTART |
| 592 | /* don't want reads to restart. If SA_RESTART is defined, we know |
| 593 | * sigaction exists and can be used to ensure reads won't restart. |
| 594 | * If it's not defined, assume reads do not restart. If reads restart |
| 595 | * and a signal occurs, the game won't do anything until the read |
| 596 | * succeeds (or the stream returns EOF, which might not happen if |
| 597 | * reading from, say, a window manager). */ |
| 598 | struct sigaction sact; |
| 599 | |
| 600 | (void) memset((genericptr_t) &sact, 0, sizeof sact); |
| 601 | sact.sa_handler = (SIG_RET_TYPE) handler; |
| 602 | (void) sigaction(SIGHUP, &sact, (struct sigaction *) 0); |
| 603 | #ifdef SIGXCPU |
| 604 | (void) sigaction(SIGXCPU, &sact, (struct sigaction *) 0); |
| 605 | #endif |
| 606 | #else /* !SA_RESTART */ |
| 607 | (void) signal(SIGHUP, (SIG_RET_TYPE) handler); |
| 608 | #ifdef SIGXCPU |
| 609 | (void) signal(SIGXCPU, (SIG_RET_TYPE) handler); |
| 610 | #endif |
| 611 | #endif /* ?SA_RESTART */ |
| 612 | } |
| 613 | |
| 614 | #ifdef PORT_HELP |
| 615 | void |