E void FDECL(done, (int));
E void FDECL(container_contents, (struct obj *, BOOLEAN_P,
BOOLEAN_P, BOOLEAN_P));
-E void FDECL(terminate, (int)) NORETURN;
+E void FDECL(nh_terminate, (int)) NORETURN;
E int NDECL(dovanquished);
E int NDECL(num_genocides);
E void FDECL(delayed_killer, (int, int, const char *));
if (iflags.window_inited)
exit_nhwindows((char *) 0);
clearlocks();
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
/*NOTREACHED*/ /* not necessarily true for vms... */
return;
}
panic(
"Premature EOF on dungeon description file!\r\nExpected %d bytes - got %d.",
(size * nitems), (size * cnt));
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
}
}
raw_print("");
raw_print("");
}
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
}
void
/* should be called with either EXIT_SUCCESS or EXIT_FAILURE */
void
-terminate(status)
+nh_terminate(status)
int status;
{
program_state.in_moveloop = 0; /* won't be returning to normal play */
#ifdef VMS
/*
* This is liable to draw a warning if compiled with gcc, but it's
- * more important to flag panic() -> really_done() -> terminate()
+ * more important to flag panic() -> really_done() -> nh_terminate()
* as __noreturn__ then to avoid the warning.
*/
/* don't call exit() if already executing within an exit handler;
if (freopen(filename, mode, stream) == (FILE *) 0) {
(void) fprintf(stderr, "freopen of %s for %scompress failed\n",
filename, uncomp ? "un" : "");
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
}
}
perror((char *) 0);
(void) fprintf(stderr, "Exec to %scompress %s failed.\n",
uncomp ? "un" : "", filename);
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
} else if (f == -1) {
perror((char *) 0);
pline("Fork to %scompress %s failed.", uncomp ? "un" : "", filename);
if (child(1)) {
(void) execl(mr, mr, (char *) 0);
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
}
#else
#ifndef AMS /* AMS mailboxes are directories */
/* ... and _must_ parse correctly. */
if (!read_config_file(SYSCF_FILE, SET_IN_SYS)) {
raw_printf("Error(s) found in SYSCF_FILE, quitting.");
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
}
/*
* TODO [maybe]: parse the sysopt entries which are space-separated
(void) execv(args[0], (char *const *) args);
perror((char *) 0);
(void) fprintf(stderr, "Exec to message handler %s failed.\n", env);
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
} else if (f > 0) {
int status;
}
#endif /* ?AMIGA */
pline("Be seeing you...");
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
}
#endif /* MFLOPPY */
bufon(nfd);
/* make sure they see the Saving message */
display_nhwindow(WIN_MESSAGE, TRUE);
exit_nhwindows("Be seeing you...");
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
} else
(void) doredraw();
}
if (failed) {
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
if (program_state.done_hup)
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
else
#endif
panic("cannot write %u bytes to file #%d", num, fd);
if (write(fd, outbuf, outbufp) != outbufp) {
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
if (program_state.done_hup)
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
else
#endif
zerocomp_bclose(fd); /* panic (outbufp != 0) */
if ((unsigned) write(fd, loc, num) != num) {
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
if (program_state.done_hup)
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
else
#endif
panic("cannot write %u bytes to file #%d", num, fd);
}
if (windowprocs.win_raw_print == def_raw_print)
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
wait_synch();
}
if (*plname == '\33') {
clearlocks();
exit_nhwindows(NULL);
- terminate(0);
+ nh_terminate(0);
}
}
CloseShWindow( cwin );
clearlocks();
exit_nhwindows(NULL);
- terminate(0);
+ nh_terminate(0);
}
else
DisplayBeep( NULL );
CloseShWindow( cwin );
clearlocks();
exit_nhwindows(NULL);
- terminate(0);
+ nh_terminate(0);
break;
}
}
free((genericptr_t) selected);
clearlocks();
exit_nhwindows(NULL);
- terminate(0);
+ nh_terminate(0);
/*NOTREACHED*/
return;
}
hangup(1);
#else
dosave0();
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
#endif
}
return 0;
free((PNHMainWindow) GetWindowLong(hWnd, GWL_USERDATA));
SetWindowLong(hWnd, GWL_USERDATA, (LONG) 0);
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
} break;
/*-----------------------------------------------------------------------*/
// Don't do any of this (?) - exit_nhwindows does not terminate
// the application
// DestroyWindow(GetNHApp()->hMainWnd);
- // terminate(EXIT_SUCCESS);
+ // nh_terminate(EXIT_SUCCESS);
}
/* Prepare the window to be suspended. */
{
clearlocks();
mswin_exit_nhwindows(mesg);
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
/*NOTREACHED*/
}
if (dosave0()) {
u.uhp = -1;
NetHackQtBind::qt_exit_nhwindows(0);
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
}
break;
case 1:
// Quit
clearlocks();
qt_exit_nhwindows(0);
- terminate(0);
+ nh_terminate(0);
}
void NetHackQtBind::qt_get_nh_event()
if (ps_selected == PS_QUIT || program_state.done_hup) {
clearlocks();
X11_exit_nhwindows((char *) 0);
- terminate(0);
+ nh_terminate(0);
} else if (ps_selected == PS_RANDOM) {
flags.initrole = ROLE_RANDOM;
} else if (ps_selected < 0 || ps_selected >= num_roles) {
if (ps_selected == PS_QUIT || program_state.done_hup) {
clearlocks();
X11_exit_nhwindows((char *) 0);
- terminate(0);
+ nh_terminate(0);
} else if (ps_selected == PS_RANDOM) {
flags.initrace = ROLE_RANDOM;
} else if (ps_selected < 0 || ps_selected >= num_races) {
if (ps_selected == PS_QUIT || program_state.done_hup) {
clearlocks();
X11_exit_nhwindows((char *) 0);
- terminate(0);
+ nh_terminate(0);
} else if (ps_selected == PS_RANDOM) {
flags.initgend = ROLE_RANDOM;
} else if (ps_selected < 0 || ps_selected >= num_gends) {
if (ps_selected == PS_QUIT || program_state.done_hup) {
clearlocks();
X11_exit_nhwindows((char *) 0);
- terminate(0);
+ nh_terminate(0);
} else if (ps_selected == PS_RANDOM) {
flags.initalign = ROLE_RANDOM;
} else if (ps_selected < 0 || ps_selected >= num_algns) {
{
clearlocks();
Gem_exit_nhwindows(mesg);
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
/*NOTREACHED*/
}
{
clearlocks();
tty_exit_nhwindows(mesg);
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
/*NOTREACHED*/
}
}
if (complain)
sleep(10); /* want to wait_synch() but stdin is gone */
- terminate(EXIT_FAILURE);
+ nh_terminate(EXIT_FAILURE);
}
(void) close(fd);
#ifdef notyet
{
clearlocks();
mswin_exit_nhwindows(mesg);
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
/*NOTREACHED*/
}