diff --git a/contrib/one-true-awk/FREEBSD-upgrade b/contrib/one-true-awk/FREEBSD-upgrade deleted file mode 100644 index f0f70ab7b17b..000000000000 --- a/contrib/one-true-awk/FREEBSD-upgrade +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD$ - -Import of the 2005/04/24 version of the "one true awk", as described -in "The AWK Programming Language", by Al Aho, Brian Kernighan, and -Peter Weinberger (Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Original sources were taken from the Brian Kernighan's AWK page -http://www.cs.princeton.edu/~bwk/btl.mirror -and include bug fixes up thru Oct 23, 2007. - -The following files were removed for this import: - - buildwin.bat - makefile.win - missing95.c - vcvars32.bat - ytab.c - ytab.h - ytabc.bak - ytabh.bak - -The vendor import was done by: - - cvs import src/contrib/one-true-awk BELL_LABS bwk_20071023 diff --git a/contrib/one-true-awk/README b/contrib/one-true-awk/README deleted file mode 100644 index 24aaf9092d58..000000000000 --- a/contrib/one-true-awk/README +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************** -Copyright (C) Lucent Technologies 1997 -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name Lucent Technologies or any of -its entities not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. -****************************************************************/ - -This is the version of awk described in "The AWK Programming Language", -by Al Aho, Brian Kernighan, and Peter Weinberger -(Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Changes, mostly bug fixes and occasional enhancements, are listed -in FIXES. If you distribute this code further, please please please -distribute FIXES with it. If you find errors, please report them -to bwk@cs.princeton.edu. Thanks. - -The program itself is created by - make -which should produce a sequence of messages roughly like this: - - yacc -d awkgram.y - -conflicts: 43 shift/reduce, 85 reduce/reduce - mv y.tab.c ytab.c - mv y.tab.h ytab.h - cc -c ytab.c - cc -c b.c - cc -c main.c - cc -c parse.c - cc maketab.c -o maketab - ./maketab >proctab.c - cc -c proctab.c - cc -c tran.c - cc -c lib.c - cc -c run.c - cc -c lex.c - cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm - -This produces an executable a.out; you will eventually want to -move this to some place like /usr/bin/awk. - -If your system does not have yacc or bison (the GNU -equivalent), you must compile the pieces manually. We have -included yacc output in ytab.c and ytab.h, and backup copies in -case you overwrite them. We have also included a copy of -proctab.c so you do not need to run maketab. - -NOTE: This version uses ANSI C, as you should also. We have -compiled this without any changes using gcc -Wall and/or local C -compilers on a variety of systems, but new systems or compilers -may raise some new complaint; reports of difficulties are -welcome. - -This also compiles with Visual C++ on all flavors of Windows, -*if* you provide versions of popen and pclose. The file -missing95.c contains versions that can be used to get started -with, though the underlying support has mysterious properties, -the symptom of which can be truncated pipe output. Beware. The -file makefile.win gives hints on how to proceed; if you run -vcvars32.bat, it will set up necessary paths and parameters so -you can subsequently run nmake -f makefile.win. Beware also that -when running on Windows under command.com, various quoting -conventions are different from Unix systems: single quotes won't -work around arguments, and various characters like % are -interpreted within double quotes. - -This compiles without change on Macintosh OS X using gcc and -the standard developer tools. - -This is also said to compile on Macintosh OS 9 systems, using the -file "buildmac" provided by Dan Allen (danallen@microsoft.com), -to whom many thanks. - -The version of malloc that comes with some systems is sometimes -astonishly slow. If awk seems slow, you might try fixing that. -More generally, turning on optimization can significantly improve -awk's speed, perhaps by 1/3 for highest levels. diff --git a/contrib/one-true-awk/README.md b/contrib/one-true-awk/README.md new file mode 100644 index 000000000000..b8089b3a4803 --- /dev/null +++ b/contrib/one-true-awk/README.md @@ -0,0 +1,119 @@ +# The One True Awk + +This is the version of `awk` described in _The AWK Programming Language_, +by Al Aho, Brian Kernighan, and Peter Weinberger +(Addison-Wesley, 1988, ISBN 0-201-07981-X). + +## Copyright + +Copyright (C) Lucent Technologies 1997
+All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +## Distribution and Reporting Problems + +Changes, mostly bug fixes and occasional enhancements, are listed +in `FIXES`. If you distribute this code further, please please please +distribute `FIXES` with it. + +If you find errors, please report them +to bwk@cs.princeton.edu. +Please _also_ open an issue in the GitHub issue tracker, to make +it easy to track issues. +Thanks. + +## Submitting Pull Requests + +Pull requests are welcome. Some guidelines: + +* Please do not use functions or facilities that are not standard (e.g., +`strlcpy()`, `fpurge()`). + +* Please run the test suite and make sure that your changes pass before +posting the pull request. To do so: + + 1. Save the previous version of `awk` somewhere in your path. Call it `nawk` (for example). + 1. Run `oldawk=nawk make check > check.out 2>&1`. + 1. Search for `BAD` or `error` in the result. In general, look over it manually to make sure there are no errors. + +* Please create the pull request with a request +to merge into the `staging` branch instead of into the `master` branch. +This allows us to do testing, and to make any additional edits or changes +after the merge but before merging to `master`. + +## Building + +The program itself is created by + + make + +which should produce a sequence of messages roughly like this: + + yacc -d awkgram.y + conflicts: 43 shift/reduce, 85 reduce/reduce + mv y.tab.c ytab.c + mv y.tab.h ytab.h + cc -c ytab.c + cc -c b.c + cc -c main.c + cc -c parse.c + cc maketab.c -o maketab + ./maketab >proctab.c + cc -c proctab.c + cc -c tran.c + cc -c lib.c + cc -c run.c + cc -c lex.c + cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm + +This produces an executable `a.out`; you will eventually want to +move this to some place like `/usr/bin/awk`. + +If your system does not have `yacc` or `bison` (the GNU +equivalent), you need to install one of them first. + +NOTE: This version uses ANSI C (C 99), as you should also. We have +compiled this without any changes using `gcc -Wall` and/or local C +compilers on a variety of systems, but new systems or compilers +may raise some new complaint; reports of difficulties are +welcome. + +This compiles without change on Macintosh OS X using `gcc` and +the standard developer tools. + +You can also use `make CC=g++` to build with the GNU C++ compiler, +should you choose to do so. + +The version of `malloc` that comes with some systems is sometimes +astonishly slow. If `awk` seems slow, you might try fixing that. +More generally, turning on optimization can significantly improve +`awk`'s speed, perhaps by 1/3 for highest levels. + +## A Note About Maintenance + +NOTICE! Maintenance of this program is on a ``best effort'' +basis. We try to get to issues and pull requests as quickly +as we can. Unfortunately, however, keeping this program going +is not at the top of our priority list. + +#### Last Updated + +Fri Dec 25 16:53:34 EST 2020 diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 230eac41548c..51c00df9f279 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -237,8 +237,6 @@ extern int pairstack[], paircnt; /* watch out in match(), etc. */ #define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 -#define HAT (NCHARS+2) /* matches ^ in regular expr */ - /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 20f4a8bee7f9..dd64f09647b0 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -614,22 +614,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */ } nextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) -n xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of space in pmatch"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif - } while (*p++ != 0); + } while (*p++); return (0); } @@ -670,21 +655,6 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */ } nnextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) - xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of state space"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif p++; } return (0);