=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/awk/lex.c,v retrieving revision 1.17 retrieving revision 1.18 diff -c -r1.17 -r1.18 *** src/usr.bin/awk/lex.c 2020/06/10 21:04:40 1.17 --- src/usr.bin/awk/lex.c 2020/06/10 21:05:02 1.18 *************** *** 1,4 **** ! /* $OpenBSD: lex.c,v 1.17 2020/06/10 21:04:40 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved --- 1,4 ---- ! /* $OpenBSD: lex.c,v 1.18 2020/06/10 21:05:02 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved *************** *** 44,50 **** int type; } Keyword; ! Keyword keywords[] ={ /* keep sorted: binary searched */ { "BEGIN", XBEGIN, XBEGIN }, { "END", XEND, XEND }, { "NF", VARNF, VARNF }, --- 44,50 ---- int type; } Keyword; ! const Keyword keywords[] = { /* keep sorted: binary searched */ { "BEGIN", XBEGIN, XBEGIN }, { "END", XEND, XEND }, { "NF", VARNF, VARNF }, *************** *** 102,115 **** int gettok(char **, int *); int binsearch(char *, Keyword *, int); ! int peek(void) { int c = input(); unput(c); return c; } ! int gettok(char **pbuf, int *psz) /* get next input token */ { int c, retc; char *buf = *pbuf; --- 102,115 ---- int gettok(char **, int *); int binsearch(char *, Keyword *, int); ! static int peek(void) { int c = input(); unput(c); return c; } ! static int gettok(char **pbuf, int *psz) /* get next input token */ { int c, retc; char *buf = *pbuf; *************** *** 401,407 **** case 'r': *bp++ = '\r'; break; case 'b': *bp++ = '\b'; break; case 'v': *bp++ = '\v'; break; ! case 'a': *bp++ = '\007'; break; case '\\': *bp++ = '\\'; break; case '0': case '1': case '2': /* octal: \d \dd \ddd */ --- 401,407 ---- case 'r': *bp++ = '\r'; break; case 'b': *bp++ = '\b'; break; case 'v': *bp++ = '\v'; break; ! case 'a': *bp++ = '\a'; break; case '\\': *bp++ = '\\'; break; case '0': case '1': case '2': /* octal: \d \dd \ddd */ *************** *** 451,457 **** } ! int binsearch(char *w, Keyword *kp, int n) { int cond, low, mid, high; --- 451,457 ---- } ! static int binsearch(char *w, const Keyword *kp, int n) { int cond, low, mid, high; *************** *** 471,477 **** int word(char *w) { ! Keyword *kp; int c, n; n = binsearch(w, keywords, sizeof(keywords)/sizeof(keywords[0])); --- 471,477 ---- int word(char *w) { ! const Keyword *kp; int c, n; n = binsearch(w, keywords, sizeof(keywords)/sizeof(keywords[0])); *************** *** 587,592 **** --- 587,594 ---- void unput(int c) /* put lexical character back on input */ { + if (c == '\n') + lineno--; if (yysptr >= yysbuf + sizeof(yysbuf)) FATAL("pushed back too much: %.20s...", yysbuf); *yysptr++ = c;