date and time created 83/02/11 15:44:54 by rrh
[unix-history] / usr / src / usr.bin / ex / ex_get.c
index 9f41fab..4fd5135 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (c) 1980 Regents of the University of California */
-static char *sccsid = "@(#)ex_get.c    6.1 %G%";
+/* Copyright (c) 1981 Regents of the University of California */
+static char *sccsid = "@(#)ex_get.c    7.1     %G%";
 #include "ex.h"
 #include "ex_tty.h"
 
 #include "ex.h"
 #include "ex_tty.h"
 
@@ -55,7 +55,6 @@ peekchar()
 
 peekcd()
 {
 
 peekcd()
 {
-
        if (peekc == 0)
                peekc = getcd();
        return (peekc);
        if (peekc == 0)
                peekc = getcd();
        return (peekc);
@@ -65,6 +64,7 @@ getach()
 {
        register int c;
        static char inline[128];
 {
        register int c;
        static char inline[128];
+       struct stat statb;
 
        c = peekc;
        if (c != 0) {
 
        c = peekc;
        if (c != 0) {
@@ -102,8 +102,11 @@ top:
                input = inline;
                goto top;
        }
                input = inline;
                goto top;
        }
-       if (read(0, (char *) &lastc, 1) != 1)
+/* mjm:        if (read(0, (char *) &lastc, 1) != 1)   CHANGED and added else */
+       if (read(0, inline, 1) != 1)
                lastc = EOF;
                lastc = EOF;
+       else                            /* mjm: lastc is a short! */
+               lastc = inline[0];      /* mjm: in rightmost 8 bits ! */
        return (lastc);
 }
 
        return (lastc);
 }