summaryrefslogtreecommitdiff
path: root/usr.bin/awk/lex.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-12-30 01:52:49 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-12-30 01:52:49 +0000
commit92f3150912b4d375df827a15d8e929575c71c014 (patch)
treef638bbe716809fd27621b25c2813a1e9478a88bc /usr.bin/awk/lex.c
parent0f3aec300d9d954add1864f9c69be31ab4f02569 (diff)
Update to version 20041222; OK deraadt@
Diffstat (limited to 'usr.bin/awk/lex.c')
-rw-r--r--usr.bin/awk/lex.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/awk/lex.c b/usr.bin/awk/lex.c
index 49471d46f5c..737f589ea66 100644
--- a/usr.bin/awk/lex.c
+++ b/usr.bin/awk/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.7 2003/07/02 21:04:09 deraadt Exp $ */
+/* $OpenBSD: lex.c,v 1.8 2004/12/30 01:52:48 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -157,6 +157,7 @@ int gettok(char **pbuf, int *psz) /* get next input token */
*bp = 0;
strtod(buf, &rem); /* parse the number */
unputstr(rem); /* put rest back for later */
+/* printf("unputstr [%s], buf [%s]\n", rem, buf); */
if (rem == buf) { /* it wasn't a valid number at all */
buf[1] = 0; /* so return one character as token */
retc = buf[0]; /* character is its own type */
@@ -192,8 +193,10 @@ int yylex(void)
reg = 0;
return regexpr();
}
+/* printf("top\n"); */
for (;;) {
c = gettok(&buf, &bufsize);
+/* printf("gettok [%s]\n", buf); */
if (c == 0)
return 0;
if (isalpha(c) || c == '_')
@@ -534,6 +537,8 @@ int regexpr(void)
}
}
*bp = 0;
+ if (c == 0)
+ SYNTAX("non-terminated regular expression %.10s...", buf);
yylval.s = tostring(buf);
unput('/');
RET(REGEXPR);
@@ -553,9 +558,9 @@ int input(void) /* get next lexical input character */
extern char *lexprog;
if (yysptr > yysbuf)
- c = *--yysptr;
+ c = (uschar)*--yysptr;
else if (lexprog != NULL) { /* awk '...' */
- if ((c = *lexprog) != 0)
+ if ((c = (uschar)*lexprog) != 0)
lexprog++;
} else /* awk -f ... */
c = pgetc();