summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-05-10 19:13:08 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-05-10 19:13:08 +0000
commit5573c1249e286dd9f1223eee369ba0198ff987d3 (patch)
tree7366da6daace8d6a96c7a922fc6035fdaf9b847f /usr.bin
parentc48eabe12b38c4b211d1803fd12bf5b48a38db78 (diff)
In getlin(): match and handle EOF before checking isprint()
millert ok.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/unifdef/unifdef.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/unifdef/unifdef.c b/usr.bin/unifdef/unifdef.c
index 213e956fe55..751c1570e5e 100644
--- a/usr.bin/unifdef/unifdef.c
+++ b/usr.bin/unifdef/unifdef.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unifdef.c,v 1.4 2002/02/16 21:27:56 millert Exp $ */
+/* $OpenBSD: unifdef.c,v 1.5 2002/05/10 19:13:07 jason Exp $ */
/* $NetBSD: unifdef.c,v 1.6 1998/10/08 01:31:59 wsanchez Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)unifdef.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: unifdef.c,v 1.4 2002/02/16 21:27:56 millert Exp $";
+static char rcsid[] = "$OpenBSD: unifdef.c,v 1.5 2002/05/10 19:13:07 jason Exp $";
#endif /* not lint */
/*
@@ -587,6 +587,8 @@ getlin(line, maxline, inp, expandtabs)
#endif /* FFSPECIAL */
while (num + 8 < maxline) { /* leave room for tab */
chr = getc(inp);
+ if (chr == EOF)
+ return EOF;
if (isprint(chr)) {
#ifdef FFSPECIAL
ent:
@@ -595,9 +597,6 @@ getlin(line, maxline, inp, expandtabs)
num++;
} else
switch (chr) {
- case EOF:
- return EOF;
-
case '\t':
if (expandtabs) {
num += tmp = 8 - (num & 7);