now if you type more than 25 eofs in a row, it assumes you really
authorKurt A. Shoens <kurt@ucbvax.Berkeley.EDU>
Sun, 13 Sep 1981 01:44:52 +0000 (17:44 -0800)
committerKurt A. Shoens <kurt@ucbvax.Berkeley.EDU>
Sun, 13 Sep 1981 01:44:52 +0000 (17:44 -0800)
mean it.  this is to combat a strange dialup problem that makes your
program read eofs forever.

SCCS-vsn: usr.bin/mail/lex.c 2.3

usr/src/usr.bin/mail/lex.c

index 63a711f..e3e9056 100644 (file)
@@ -8,7 +8,7 @@
  * Lexical processing of commands.
  */
 
  * Lexical processing of commands.
  */
 
-static char *SccsId = "@(#)lex.c       2.2 %G%";
+static char *SccsId = "@(#)lex.c       2.3 %G%";
 
 /*
  * Set up editing on the given file name.
 
 /*
  * Set up editing on the given file name.
@@ -97,7 +97,7 @@ int   *msgvec;
 
 commands()
 {
 
 commands()
 {
-       int prompt, firstsw, stop();
+       int eofloop, prompt, firstsw, stop();
        register int n;
        char linebuf[LINESIZE];
        int hangup(), contin();
        register int n;
        char linebuf[LINESIZE];
        int hangup(), contin();
@@ -143,6 +143,7 @@ commands()
 
                if (!rcvmode && !sourcing)
                        return;
 
                if (!rcvmode && !sourcing)
                        return;
+               eofloop = 0;
 top:
                if (prompt && !sourcing) {
                        sigrelse(SIGCONT);
 top:
                if (prompt && !sourcing) {
                        sigrelse(SIGCONT);
@@ -166,8 +167,10 @@ top:
                                        goto more;
                                }
                                if (value("ignoreeof") != NOSTR && prompt) {
                                        goto more;
                                }
                                if (value("ignoreeof") != NOSTR && prompt) {
-                                       printf("Use \"quit\" to quit.\n");
-                                       goto top;
+                                       if (++eofloop < 25) {
+                                               printf("Use \"quit\" to quit.\n");
+                                               goto top;
+                                       }
                                }
                                if (!edit)
                                        return;
                                }
                                if (!edit)
                                        return;