document distributed with 4.1BSD
[unix-history] / usr / src / usr.bin / ex / ex_get.c
index 80395a5..2901b5c 100644 (file)
@@ -1,5 +1,13 @@
-/* Copyright (c) 1981 Regents of the University of California */
-static char *sccsid = "@(#)ex_get.c    7.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"
 
@@ -102,20 +110,12 @@ top:
                input = inline;
                goto top;
        }
                input = inline;
                goto top;
        }
-#ifdef notdef
-/* mjm:        if (read(0, (char *) &lastc, 1) != 1)   CHANGED and added else */
-       if (read(0, inline, 1) != 1)
-               lastc = EOF;
-       else                            /* mjm: lastc is a short! */
-               lastc = inline[0];      /* mjm: in rightmost 8 bits ! */
-       return (lastc);
-#else
-       c = read(0, inline, sizeof inline);
+       c = read(0, inline, sizeof inline - 1);
        if(c <= 0)
                return(lastc = EOF);
        if(c <= 0)
                return(lastc = EOF);
+       inline[c] = '\0';
        input = inline;
        goto top;
        input = inline;
        goto top;
-#endif
 }
 
 /*
 }
 
 /*