calls to nonexistant fonts (from gbergman@cartan)
[unix-history] / usr / src / usr.bin / mail / tty.c
index d56ce79..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
@@ -7,9 +15,6 @@
  */
 
 #include "rcv.h"
  */
 
 #include "rcv.h"
-#include <sgtty.h>
-
-static char *SccsId = "@(#)tty.c       2.1 %G%";
 
 static int     c_erase;                /* Current erase char */
 static int     c_kill;                 /* Current kill char */
 
 static int     c_erase;                /* Current erase char */
 static int     c_kill;                 /* Current kill char */
@@ -35,7 +40,9 @@ grabh(hp, gflags)
        register int s;
        int errs;
 
        register int s;
        int errs;
 
+# ifdef VMUNIX
        savecont = sigset(SIGCONT, signull);
        savecont = sigset(SIGCONT, signull);
+# endif VMUNIX
        errs = 0;
 #ifndef TIOCSTI
        ttyset = 0;
        errs = 0;
 #ifndef TIOCSTI
        ttyset = 0;
@@ -89,7 +96,9 @@ grabh(hp, gflags)
                if (hp->h_bcc != NOSTR)
                        hp->h_seq++;
        }
                if (hp->h_bcc != NOSTR)
                        hp->h_seq++;
        }
+# ifdef VMUNIX
        sigset(SIGCONT, savecont);
        sigset(SIGCONT, savecont);
+# endif VMUNIX
 #ifndef TIOCSTI
        ttybuf.sg_erase = c_erase;
        ttybuf.sg_kill = c_kill;
 #ifndef TIOCSTI
        ttybuf.sg_erase = c_erase;
        ttybuf.sg_kill = c_kill;
@@ -112,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);
@@ -136,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;
@@ -147,7 +157,10 @@ readtty(pr, src)
        cp2 = cp;
        if (setjmp(rewrite))
                goto redo;
        cp2 = cp;
        if (setjmp(rewrite))
                goto redo;
+# ifdef VMUNIX
        sigset(SIGCONT, ttycont);
        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')
@@ -155,7 +168,9 @@ readtty(pr, src)
                *cp2++ = c;
        }
        *cp2 = 0;
                *cp2++ = c;
        }
        *cp2 = 0;
+# ifdef VMUNIX
        sigset(SIGCONT, signull);
        sigset(SIGCONT, signull);
+# endif VMUNIX
        if (c == EOF && ferror(stdin) && hadcont) {
 redo:
                hadcont = 0;
        if (c == EOF && ferror(stdin) && hadcont) {
 redo:
                hadcont = 0;
@@ -164,9 +179,9 @@ redo:
                return(readtty(pr, cp));
        }
 #ifndef TIOCSTI
                return(readtty(pr, cp));
        }
 #ifndef TIOCSTI
-       if (cp2 == NOSTR || *cp2 == '\0')
+       if (cp == NOSTR || *cp == '\0')
                return(src);
                return(src);
-       cp = cp2;
+       cp2 = cp;
        if (!ttyset)
                return(strlen(canonb) > 0 ? savestr(canonb) : NOSTR);
        while (*cp != '\0') {
        if (!ttyset)
                return(strlen(canonb) > 0 ? savestr(canonb) : NOSTR);
        while (*cp != '\0') {
@@ -200,6 +215,7 @@ redo:
        return(savestr(canonb));
 }
 
        return(savestr(canonb));
 }
 
+# ifdef VMUNIX
 /*
  * Receipt continuation.
  */
 /*
  * Receipt continuation.
  */
@@ -207,9 +223,9 @@ ttycont(s)
 {
 
        hadcont++;
 {
 
        hadcont++;
-       sigrelse(SIGCONT);
        longjmp(rewrite, 1);
 }
        longjmp(rewrite, 1);
 }
+# endif VMUNIX
 
 /*
  * Null routine to satisfy
 
 /*
  * Null routine to satisfy