several hangup tweaks (trunk only)

NOSAVEONHANGUP isn't documented anywhere.  I don't see why it should
wipe out recoverable level files just because it doesn't want to build a
save file out of them during the hangup.  Leave them intact if checkpoint
is active.  If someone really wants to make them always go away, they'll
need to disable INSURANCE as well as enable NOSAVEONHANGUP.

     tty's getret() -> xwaitforspace() could get stuck in a loop after
hangup, depending upon the state of terminal shutdown (accepting EOF or
ESC cares about cbreak mode?).  Make xwaitforspace() become a no-op during
hangup processing.

     vms's call to hangup() from an exit handler took place after the
terminal has been reset (the exit handler for the latter is registered
later so executes sooner).  Then exit_nhwindows() resulted in a second tty
reset attempt and settty() -> setctty() encountered an error (which it
reported, triggeting a getret() call).  Make the vms code correctly guard
against multiple resets.
This commit is contained in:
nethack.rankin
2007-02-01 06:15:04 +00:00
parent e7cb81fe7b
commit fdbc2c9e86
3 changed files with 16 additions and 6 deletions

View File

@@ -2825,13 +2825,18 @@ void
end_of_input()
{
# ifdef NOSAVEONHANGUP
program_state.something_worth_saving = 0;
# ifdef INSURANCE
if (flags.ins_chkpt && program_state.something_worth_saving)
program_statue.preserve_locks = 1; /* keep files for recovery */
# endif
program_state.something_worth_saving = 0; /* don't save */
# endif
# ifndef SAFERHANGUP
if (!program_state.done_hup++)
# endif
if (program_state.something_worth_saving) (void) dosave0();
exit_nhwindows((char *)0);
if (iflags.window_inited) exit_nhwindows((char *)0);
clearlocks();
terminate(EXIT_SUCCESS);
/*NOTREACHED*/ /* not necessarily true for vms... */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)vmstty.c 3.5 2007/01/08 */
/* SCCS Id: @(#)vmstty.c 3.5 2007/01/31 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* tty.c - (VMS) version */
@@ -375,8 +375,9 @@ void
settty(s)
const char *s;
{
if (!bombing) end_screen();
if (s) raw_print(s);
if (!bombing) end_screen();
if (s) raw_print(s);
if (settty_needed) {
disable_broadcast_trapping();
#if 0 /* let SMG's exit handler do the cleanup (as per doc) */
/* #ifndef USE_QIO_INPUT */
@@ -392,6 +393,7 @@ const char *s;
setctty();
settty_needed = FALSE;
}
}
/* same as settty, with no clearing of the screen */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)getline.c 3.5 2002/10/06 */
/* SCCS Id: @(#)getline.c 3.5 2007/01/31 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -226,6 +226,9 @@ register const char *s; /* chars allowed besides return */
register int c, x = ttyDisplay ? (int) ttyDisplay->dismiss_more : '\n';
morc = 0;
#ifdef HANGUPHANDLING
if (program_state.done_hup) return;
#endif
while((c = tty_nhgetch()) != '\n') {
if(iflags.cbreak) {