purge pending output when fielding SIGINT (signal handling still
[unix-history] / usr / src / usr.bin / more / signal.c
index e742748..2cd56bf 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)signal.c   5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)signal.c   5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -93,6 +93,14 @@ winch()
 #endif
 #endif
 
 #endif
 #endif
 
+static int
+purgeandquit()
+{
+
+       purge();        /* purge buffered output */
+       quit();
+}
+
 /*
  * Set up the signal handlers.
  */
 /*
  * Set up the signal handlers.
  */
@@ -106,7 +114,7 @@ init_signals(on)
                /*
                 * Set signal handlers.
                 */
                /*
                 * Set signal handlers.
                 */
-               (void)signal(SIGINT, quit);
+               (void)signal(SIGINT, purgeandquit);
 #ifdef SIGTSTP
                (void)signal(SIGTSTP, stop);
 #endif
 #ifdef SIGTSTP
                (void)signal(SIGTSTP, stop);
 #endif