document distributed with 4.2BSD
[unix-history] / usr / src / usr.bin / mail / tty.c
index c5c8275..be56f74 100644 (file)
@@ -1,4 +1,12 @@
-#
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char *sccsid = "@(#)tty.c       5.2 (Berkeley) %G%";
+#endif not lint
 
 /*
  * Mail -- a mail program
 
 /*
  * Mail -- a mail program
@@ -8,8 +16,6 @@
 
 #include "rcv.h"
 
 
 #include "rcv.h"
 
-static char *SccsId = "@(#)tty.c       2.3 %G%";
-
 static int     c_erase;                /* Current erase char */
 static int     c_kill;                 /* Current kill char */
 static int     hadcont;                /* Saw continue signal */
 static int     c_erase;                /* Current erase char */
 static int     c_kill;                 /* Current kill char */
 static int     hadcont;                /* Saw continue signal */
@@ -115,8 +121,8 @@ char *
 readtty(pr, src)
        char pr[], src[];
 {
 readtty(pr, src)
        char pr[], src[];
 {
-       char canonb[BUFSIZ];
-       int c, ch, signull();
+       char ch, canonb[BUFSIZ];
+       int c, signull();
        register char *cp, *cp2;
 
        fputs(pr, stdout);
        register char *cp, *cp2;
 
        fputs(pr, stdout);
@@ -139,7 +145,8 @@ readtty(pr, src)
                        ch = '\\';
                        ioctl(0, TIOCSTI, &ch);
                }
                        ch = '\\';
                        ioctl(0, TIOCSTI, &ch);
                }
-               ioctl(0, TIOCSTI, &c);
+               ch = c;
+               ioctl(0, TIOCSTI, &ch);
        }
        cp = canonb;
        *cp = 0;
        }
        cp = canonb;
        *cp = 0;
@@ -153,6 +160,7 @@ readtty(pr, src)
 # ifdef VMUNIX
        sigset(SIGCONT, ttycont);
 # endif VMUNIX
 # ifdef VMUNIX
        sigset(SIGCONT, ttycont);
 # endif VMUNIX
+       clearerr(stdin);
        while (cp2 < canonb + BUFSIZ) {
                c = getc(stdin);
                if (c == EOF || c == '\n')
        while (cp2 < canonb + BUFSIZ) {
                c = getc(stdin);
                if (c == EOF || c == '\n')
@@ -215,7 +223,6 @@ ttycont(s)
 {
 
        hadcont++;
 {
 
        hadcont++;
-       sigrelse(SIGCONT);
        longjmp(rewrite, 1);
 }
 # endif VMUNIX
        longjmp(rewrite, 1);
 }
 # endif VMUNIX