diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2020-07-30 17:45:45 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2020-07-30 17:45:45 +0000 |
commit | c8a944f12f7ae6fc2ca46c773045caf38d134ca5 (patch) | |
tree | c17bc3f0f3ae2639961d469f180221cd52200d02 | |
parent | 8eb0e7b1b3093fd1161c9bf0ed24b637af9af066 (diff) |
Update awk to July 30, 2020 version.
-rw-r--r-- | usr.bin/awk/FIXES | 9 | ||||
-rw-r--r-- | usr.bin/awk/Makefile | 16 | ||||
-rw-r--r-- | usr.bin/awk/b.c | 4 | ||||
-rw-r--r-- | usr.bin/awk/lex.c | 4 | ||||
-rw-r--r-- | usr.bin/awk/lib.c | 3 | ||||
-rw-r--r-- | usr.bin/awk/main.c | 7 | ||||
-rw-r--r-- | usr.bin/awk/maketab.c | 8 | ||||
-rw-r--r-- | usr.bin/awk/parse.c | 4 | ||||
-rw-r--r-- | usr.bin/awk/run.c | 4 | ||||
-rw-r--r-- | usr.bin/awk/tran.c | 3 |
10 files changed, 33 insertions, 29 deletions
diff --git a/usr.bin/awk/FIXES b/usr.bin/awk/FIXES index faed16320ec..4f63d5c61f2 100644 --- a/usr.bin/awk/FIXES +++ b/usr.bin/awk/FIXES @@ -1,4 +1,4 @@ -/* $OpenBSD: FIXES,v 1.36 2020/07/02 19:06:22 millert Exp $ */ +/* $OpenBSD: FIXES,v 1.37 2020/07/30 17:45:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -26,6 +26,13 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +July 30, 2020: + Merge PRs 88-91 which fix small bugs. Thanks to Todd Miller and + Tim van der Molen for the fixes. + + In order to make life easier, we move exclusively to bison + as the parser generator. + July 2, 2020: Merge PRs 85 and 86 which fix regressions. Thanks to Tim van der Molen for the fixes. diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index 5d817dbcea9..ae4e3c2850a 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -1,22 +1,22 @@ -# $OpenBSD: Makefile,v 1.17 2020/06/10 21:01:50 millert Exp $ +# $OpenBSD: Makefile,v 1.18 2020/07/30 17:45:44 millert Exp $ PROG= awk -SRCS= ytab.c lex.c b.c main.c parse.c proctab.c tran.c lib.c run.c +SRCS= awkgram.tab.c lex.c b.c main.c parse.c proctab.c tran.c lib.c run.c LDADD= -lm DPADD= ${LIBM} -CLEANFILES+=proctab.c maketab ytab.c ytab.h +CLEANFILES+=proctab.c maketab awkgram.tab.c awkgram.tab.h CFLAGS+=-I. -I${.CURDIR} -DHAS_ISBLANK -DNDEBUG HOSTCFLAGS+=-I. -I${.CURDIR} -DHAS_ISBLANK -DNDEBUG -ytab.c ytab.h: awkgram.y - ${YACC} -o ytab.c -d ${.CURDIR}/awkgram.y +awkgram.tab.c awkgram.tab.h: awkgram.y + ${YACC} -o awkgram.tab.c -d ${.CURDIR}/awkgram.y -BUILDFIRST = ytab.h +BUILDFIRST = awkgram.tab.h proctab.c: maketab - ./maketab ytab.h >proctab.c + ./maketab awkgram.tab.h >proctab.c -maketab: ytab.h maketab.c +maketab: awkgram.tab.h maketab.c ${HOSTCC} ${HOSTCFLAGS} ${.CURDIR}/maketab.c -o $@ .include <bsd.prog.mk> diff --git a/usr.bin/awk/b.c b/usr.bin/awk/b.c index 8622bcae6c6..cef1bbd29bd 100644 --- a/usr.bin/awk/b.c +++ b/usr.bin/awk/b.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b.c,v 1.33 2020/07/13 14:03:52 millert Exp $ */ +/* $OpenBSD: b.c,v 1.34 2020/07/30 17:45:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -33,7 +33,7 @@ THIS SOFTWARE. #include <string.h> #include <stdlib.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" #define MAXLIN 22 diff --git a/usr.bin/awk/lex.c b/usr.bin/awk/lex.c index 02df0824cd5..6a835c24cb1 100644 --- a/usr.bin/awk/lex.c +++ b/usr.bin/awk/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.24 2020/07/30 17:11:10 millert Exp $ */ +/* $OpenBSD: lex.c,v 1.25 2020/07/30 17:45:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -28,7 +28,7 @@ THIS SOFTWARE. #include <string.h> #include <ctype.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" extern YYSTYPE yylval; extern bool infunc; diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index 0f0b74dc0c8..d491f1a8dd8 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.39 2020/06/26 15:57:39 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.40 2020/07/30 17:45:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -32,7 +32,6 @@ THIS SOFTWARE. #include <stdarg.h> #include <limits.h> #include "awk.h" -#include "ytab.h" char EMPTY[] = { '\0' }; FILE *infile = NULL; diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c index b36067bf516..47ac56d1833 100644 --- a/usr.bin/awk/main.c +++ b/usr.bin/awk/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.43 2020/07/02 19:06:22 millert Exp $ */ +/* $OpenBSD: main.c,v 1.44 2020/07/30 17:45:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -23,7 +23,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -const char *version = "version 20200702"; +const char *version = "version 20200730"; #define DEBUG #include <stdio.h> @@ -34,7 +34,6 @@ const char *version = "version 20200702"; #include <signal.h> #include <unistd.h> #include "awk.h" -#include "ytab.h" extern char **environ; extern int nfields; @@ -289,7 +288,7 @@ int pgetc(void) /* get 1 character from awk program */ char *cursource(void) /* current source file name */ { if (npfile > 0) - return pfile[curpfile]; + return pfile[curpfile < npfile ? curpfile : curpfile - 1]; else return NULL; } diff --git a/usr.bin/awk/maketab.c b/usr.bin/awk/maketab.c index c3d4bc202f6..6dd4b773c92 100644 --- a/usr.bin/awk/maketab.c +++ b/usr.bin/awk/maketab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: maketab.c,v 1.19 2020/06/13 01:21:01 millert Exp $ */ +/* $OpenBSD: maketab.c,v 1.20 2020/07/30 17:45:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -26,14 +26,14 @@ THIS SOFTWARE. /* * this program makes the table to link function names * and type indices that is used by execute() in run.c. - * it finds the indices in ytab.h, produced by yacc. + * it finds the indices in awkgram.tab.h, produced by bison. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" struct xx { int token; @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) printf("#include <stdio.h>\n"); printf("#include \"awk.h\"\n"); - printf("#include \"ytab.h\"\n\n"); + printf("#include \"awkgram.tab.h\"\n\n"); if (argc != 2) { fprintf(stderr, "usage: maketab YTAB_H\n"); diff --git a/usr.bin/awk/parse.c b/usr.bin/awk/parse.c index b0a25c94e70..8b14f46f4e9 100644 --- a/usr.bin/awk/parse.c +++ b/usr.bin/awk/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.11 2020/06/26 15:57:39 millert Exp $ */ +/* $OpenBSD: parse.c,v 1.12 2020/07/30 17:45:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -28,7 +28,7 @@ THIS SOFTWARE. #include <string.h> #include <stdlib.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" Node *nodealloc(int n) { diff --git a/usr.bin/awk/run.c b/usr.bin/awk/run.c index 357a79ccb71..b098edf6147 100644 --- a/usr.bin/awk/run.c +++ b/usr.bin/awk/run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: run.c,v 1.65 2020/07/20 18:57:19 millert Exp $ */ +/* $OpenBSD: run.c,v 1.66 2020/07/30 17:45:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -39,7 +39,7 @@ THIS SOFTWARE. #include <sys/types.h> #include <sys/wait.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" static void stdinit(void); static void flush_all(void); diff --git a/usr.bin/awk/tran.c b/usr.bin/awk/tran.c index ccf364e1e4c..8f96c33dc97 100644 --- a/usr.bin/awk/tran.c +++ b/usr.bin/awk/tran.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tran.c,v 1.29 2020/06/26 15:57:39 millert Exp $ */ +/* $OpenBSD: tran.c,v 1.30 2020/07/30 17:45:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -30,7 +30,6 @@ THIS SOFTWARE. #include <string.h> #include <stdlib.h> #include "awk.h" -#include "ytab.h" #define FULLTAB 2 /* rehash when table gets this x full */ #define GROWTAB 4 /* grow table by this factor */ |