Added ignoreeof flag which requires explicit quit instead of
[unix-history] / usr / src / usr.bin / mail / lex.c
index 73a25df..1328950 100644 (file)
@@ -8,7 +8,7 @@
  * Lexical processing of commands.
  */
 
  * Lexical processing of commands.
  */
 
-static char *SccsId = "@(#)lex.c       1.1 %G%";
+static char *SccsId = "@(#)lex.c       1.2 %G%";
 
 /*
  * Interpret user commands one by one.  If standard input is not a tty,
 
 /*
  * Interpret user commands one by one.  If standard input is not a tty,
@@ -60,6 +60,7 @@ commands()
 
                if (!rcvmode && !sourcing)
                        return;
 
                if (!rcvmode && !sourcing)
                        return;
+top:
                if (prompt && !sourcing)
                        printf("_\r");
                flush();
                if (prompt && !sourcing)
                        printf("_\r");
                flush();
@@ -79,6 +80,10 @@ commands()
                                        unstack();
                                        goto more;
                                }
                                        unstack();
                                        goto more;
                                }
+                               if (value("ignoreeof") != NOSTR && prompt) {
+                                       printf("Use \"quit\" to quit.\n");
+                                       goto top;
+                               }
                                if (!edit) {
                                        signal(SIGINT, SIG_IGN);
                                        return;
                                if (!edit) {
                                        signal(SIGINT, SIG_IGN);
                                        return;