SAFERHANGUP
This is an initial round of SAFERHANGUP hangup changes. It introduces SAFERHANGUP, provides the core framework, and enables it for UNIX. Window-port changes are provided for win/tty, win/X11 and win/gnome. Qt changes should be forthcoming after having Warwick look at them. window.doc is updated so windowport maintainers have an clue what needs to be done to support SAFERHANGUP.
This commit is contained in:
@@ -163,9 +163,28 @@ char *argv[];
|
||||
* It seems you really want to play.
|
||||
*/
|
||||
u.uhp = 1; /* prevent RIP on early quits */
|
||||
#ifdef SA_RESTART
|
||||
/* don't want reads to restart. If SA_RESTART is defined, we know
|
||||
* sigaction exists and can be used to ensure reads won't restart.
|
||||
* If it's not defined, assume reads do not restart. If reads restart
|
||||
* and a signal occurs, the game won't do anything until the read
|
||||
* succeeds (or the stream returns EOF, which might not happen if
|
||||
* reading from, say, a window manager). */
|
||||
{
|
||||
struct sigaction sact;
|
||||
|
||||
(void) memset((char*) &sact, 0, sizeof(struct sigaction));
|
||||
sact.sa_handler = (SIG_RET_TYPE)hangup;
|
||||
(void) sigaction(SIGHUP, &sact, (struct sigaction*)0);
|
||||
#ifdef SIGXCPU
|
||||
(void) sigaction(SIGXCPU, &sact, (struct sigaction*)0);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
(void) signal(SIGHUP, (SIG_RET_TYPE) hangup);
|
||||
#ifdef SIGXCPU
|
||||
(void) signal(SIGXCPU, (SIG_RET_TYPE) hangup);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
process_options(argc, argv); /* command line options */
|
||||
|
||||
@@ -155,19 +155,23 @@ getlock()
|
||||
(void) printf("\nThere is already a game in progress under your name.");
|
||||
(void) printf(" Destroy old game? [yn] ");
|
||||
(void) fflush(stdout);
|
||||
c = getchar();
|
||||
(void) putchar(c);
|
||||
(void) fflush(stdout);
|
||||
while (getchar() != '\n') ; /* eat rest of line and newline */
|
||||
if ((c = getchar()) != EOF) {
|
||||
int tmp;
|
||||
|
||||
(void) putchar(c);
|
||||
(void) fflush(stdout);
|
||||
while ((tmp = getchar()) != '\n' && tmp != EOF)
|
||||
; /* eat rest of line and newline */
|
||||
}
|
||||
}
|
||||
if(c == 'y' || c == 'Y')
|
||||
if(c == 'y' || c == 'Y') {
|
||||
if(eraseoldlocks())
|
||||
goto gotlock;
|
||||
else {
|
||||
unlock_file(HLOCK);
|
||||
error("Couldn't destroy old game.");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
unlock_file(HLOCK);
|
||||
error("%s", "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user