-/* Copyright (c) 1979 Regents of the University of California */
+/* 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"
peekcd()
{
-
if (peekc == 0)
peekc = getcd();
return (peekc);
{
register int c;
static char inline[128];
+ struct stat statb;
c = peekc;
if (c != 0) {
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;
+ else /* mjm: lastc is a short! */
+ lastc = inline[0]; /* mjm: in rightmost 8 bits ! */
return (lastc);
}