document distributed with 4.1BSD
[unix-history] / usr / src / usr.bin / ex / ex_get.c
index bfb0e82..2901b5c 100644 (file)
@@ -1,5 +1,13 @@
-/* Copyright (c) 1980 Regents of the University of California */
-static char *sccsid = "@(#)ex_get.c    4.2 %G%";
+/*
+ * 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 = "@(#)ex_get.c    7.6 (Berkeley) %G%";
+#endif not lint
+
 #include "ex.h"
 #include "ex_tty.h"
 
 #include "ex.h"
 #include "ex_tty.h"
 
@@ -55,7 +63,6 @@ peekchar()
 
 peekcd()
 {
 
 peekcd()
 {
-
        if (peekc == 0)
                peekc = getcd();
        return (peekc);
        if (peekc == 0)
                peekc = getcd();
        return (peekc);
@@ -64,7 +71,8 @@ peekcd()
 getach()
 {
        register int c;
 getach()
 {
        register int c;
-       static char inline[128];
+       static char inline[BUFSIZ];
+       struct stat statb;
 
        c = peekc;
        if (c != 0) {
 
        c = peekc;
        if (c != 0) {
@@ -102,9 +110,12 @@ top:
                input = inline;
                goto top;
        }
                input = inline;
                goto top;
        }
-       if (read(0, (char *) &lastc, 1) != 1)
-               lastc = EOF;
-       return (lastc);
+       c = read(0, inline, sizeof inline - 1);
+       if(c <= 0)
+               return(lastc = EOF);
+       inline[c] = '\0';
+       input = inline;
+       goto top;
 }
 
 /*
 }
 
 /*