]> granicus.if.org Git - nethack/commitdiff
hangup followup (trunk only)
authornethack.rankin <nethack.rankin>
Fri, 2 Feb 2007 02:45:37 +0000 (02:45 +0000)
committernethack.rankin <nethack.rankin>
Fri, 2 Feb 2007 02:45:37 +0000 (02:45 +0000)
     The hangup check added to xwaitforspace() (which gets tty user's
response to --More-- and "Press Return to continue: ") wouldn't be good
enough if hangup occurred while that routine's input loop was executing.

win/tty/getline.c

index 6eb8e028e1ebb7a90407fd4a914bce69e3240591..6401ecd3aa8ef9ac15639a02465fddccef9274f5 100644 (file)
@@ -226,14 +226,16 @@ register const char *s;   /* chars allowed besides return */
     register int c, x = ttyDisplay ? (int) ttyDisplay->dismiss_more : '\n';
 
     morc = 0;
+    while (
 #ifdef HANGUPHANDLING
-    if (program_state.done_hup) return;
+          !program_state.done_hup &&
 #endif
+          (c = tty_nhgetch()) != EOF) {
+       if (c == '\n') break;
 
-    while((c = tty_nhgetch()) != '\n') {
        if(iflags.cbreak) {
-           if (c == EOF || c == '\033') {
-               ttyDisplay->dismiss_more = 1;
+           if (c == '\033') {
+               if (ttyDisplay) ttyDisplay->dismiss_more = 1;
                morc = '\033';
                break;
            }
@@ -244,7 +246,6 @@ register const char *s;     /* chars allowed besides return */
            tty_nhbell();
        }
     }
-
 }
 
 /*