summaryrefslogtreecommitdiff
path: root/usr.bin/awk/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/awk/lex.c')
-rw-r--r--usr.bin/awk/lex.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/usr.bin/awk/lex.c b/usr.bin/awk/lex.c
index 688128bdc7a..5540056222c 100644
--- a/usr.bin/awk/lex.c
+++ b/usr.bin/awk/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.2 1999/04/18 17:06:30 millert Exp $ */
+/* $OpenBSD: lex.c,v 1.3 1999/04/20 17:31:29 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -164,9 +164,9 @@ int regexpr(void);
int sc = 0; /* 1 => return a } right now */
int reg = 0; /* 1 => return a REGEXPR now */
-int yylex()
+int yylex(void)
{
- int c, n;
+ int c;
static char *buf = 0;
static int bufsize = 500;
@@ -209,7 +209,7 @@ int yylex()
RET(';');
case '\\':
if (peek() == '\n') {
- input(); lineno++;
+ input();
} else if (peek() == '\r') {
input(); input(); /* \n */
lineno++;
@@ -284,10 +284,7 @@ int yylex()
} else
RET('*');
case '/':
- if (peek() == '=') {
- input(); yylval.i = DIVEQ; RET(ASGNOP);
- } else
- RET('/');
+ RET('/');
case '%':
if (peek() == '=') {
input(); yylval.i = MODEQ; RET(ASGNOP);
@@ -302,7 +299,7 @@ int yylex()
case '$':
/* BUG: awkward, if not wrong */
c = gettok(&buf, &bufsize);
- if (c == '(' || c == '[' || (infunc && (n=isarg(buf)) >= 0)) {
+ if (c == '(' || c == '[' || (infunc && isarg(buf) >= 0)) {
unputstr(buf);
RET(INDIRECT);
} else if (isalpha(c)) {
@@ -349,7 +346,7 @@ int yylex()
}
}
-int string()
+int string(void)
{
int c, n;
char *s, *bp;
@@ -378,7 +375,7 @@ int string()
case 'r': *bp++ = '\r'; break;
case 'b': *bp++ = '\b'; break;
case 'v': *bp++ = '\v'; break;
- case 'a': *bp++ = '\a'; break;
+ case 'a': *bp++ = '\007'; break;
case '\\': *bp++ = '\\'; break;
case '0': case '1': case '2': /* octal: \d \dd \ddd */
@@ -493,7 +490,7 @@ void startreg(void) /* next call to yyles will return a regular expression */
reg = 1;
}
-int regexpr()
+int regexpr(void)
{
int c;
static char *buf = 0;