set baseline so Arnold can send pull request

This commit is contained in:
Brian Kernighan 2018-08-15 10:45:03 -04:00
parent 2af1c7c658
commit 3ed9e245db
7 changed files with 46 additions and 77042 deletions

17
FIXES
View File

@ -25,6 +25,23 @@ THIS SOFTWARE.
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987.
Jun 7, 2018:
(yes, a long layoff)
Updated some broken tests (beebe.tar, T.lilly)
[thanks to Arnold Robbins]
Mar 26, 2015:
buffer overflow in error reporting; thanks to tobias ulmer
and john-mark gurney for spotting it and the fix.
Feb 4, 2013:
cleaned up a handful of tests that didn't seem to actually
test for correct behavior: T.latin1, T.gawk.
Jan 5, 2013:
added ,NULL initializer to static Cells in run.c; not really
needed but cleaner. Thanks to Michael Bombardieri.
Dec 20, 2012:
fiddled makefile to get correct yacc and bison flags. pick yacc
(linux) or bison (mac) as necessary.

77027
awktest.a

File diff suppressed because one or more lines are too long

Binary file not shown.

2
lib.c
View File

@ -618,6 +618,8 @@ void eprint(void) /* try to print context around error */
if (compile_time == 2 || compile_time == 0 || been_here++ > 0)
return;
if (ebuf == ep)
return;
p = ep - 1;
if (p > ebuf && *p == '\n')
p--;

10
main.c
View File

@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
const char *version = "version 20121220";
const char *version = "version 20130105";
#define DEBUG
#include <stdio.h>
@ -54,6 +54,13 @@ int curpfile = 0; /* current filename */
int safe = 0; /* 1 => "safe" mode */
/* Can this work with recursive calls? I don't think so.
void segvcatch(int n)
{
FATAL("segfault. Do you have an unbounded recursive call?", n);
}
*/
int main(int argc, char *argv[])
{
const char *fs = NULL;
@ -68,6 +75,7 @@ int main(int argc, char *argv[])
exit(1);
}
signal(SIGFPE, fpecatch);
/*signal(SIGSEGV, segvcatch); experiment */
srand_seed = 1;
srand(srand_seed);

View File

@ -27,12 +27,12 @@ CFLAGS = -O2
CFLAGS =
CC = gcc -Wall -g -Wwrite-strings
CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov
CC = gcc -g -Wall -pedantic
CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing
CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov
YACC = bison -d -y
YACC = yacc -d -S
YACC = yacc -d
#YFLAGS = -d -S
# -S uses sprintf in yacc parser instead of sprint
@ -80,13 +80,14 @@ tar:
ls -l awk.zip
gitadd:
git add README LICENSE \
git add README LICENSE FIXES \
awk.h proto.h awkgram.y lex.c b.c main.c maketab.c parse.c \
lib.c run.c tran.c \
makefile awk.1 awktest.a
gitpush:
git remote add origin https://github.com/onetrueawk/awk.git
# only do this once:
# git remote add origin https://github.com/onetrueawk/awk.git
git push -u origin master
names:
@ -94,3 +95,6 @@ names:
clean:
rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda # proctab.c
cleaner:
rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda proctab.c ytab*

20
run.c
View File

@ -71,23 +71,23 @@ extern Awkfloat srand_seed;
Node *winner = NULL; /* root of parse tree */
Cell *tmps; /* free temporary cells for execution */
static Cell truecell ={ OBOOL, BTRUE, 0, 0, 1.0, NUM };
static Cell truecell ={ OBOOL, BTRUE, 0, 0, 1.0, NUM, NULL };
Cell *True = &truecell;
static Cell falsecell ={ OBOOL, BFALSE, 0, 0, 0.0, NUM };
static Cell falsecell ={ OBOOL, BFALSE, 0, 0, 0.0, NUM, NULL };
Cell *False = &falsecell;
static Cell breakcell ={ OJUMP, JBREAK, 0, 0, 0.0, NUM };
static Cell breakcell ={ OJUMP, JBREAK, 0, 0, 0.0, NUM, NULL };
Cell *jbreak = &breakcell;
static Cell contcell ={ OJUMP, JCONT, 0, 0, 0.0, NUM };
static Cell contcell ={ OJUMP, JCONT, 0, 0, 0.0, NUM, NULL };
Cell *jcont = &contcell;
static Cell nextcell ={ OJUMP, JNEXT, 0, 0, 0.0, NUM };
static Cell nextcell ={ OJUMP, JNEXT, 0, 0, 0.0, NUM, NULL };
Cell *jnext = &nextcell;
static Cell nextfilecell ={ OJUMP, JNEXTFILE, 0, 0, 0.0, NUM };
static Cell nextfilecell ={ OJUMP, JNEXTFILE, 0, 0, 0.0, NUM, NULL };
Cell *jnextfile = &nextfilecell;
static Cell exitcell ={ OJUMP, JEXIT, 0, 0, 0.0, NUM };
static Cell exitcell ={ OJUMP, JEXIT, 0, 0, 0.0, NUM, NULL };
Cell *jexit = &exitcell;
static Cell retcell ={ OJUMP, JRET, 0, 0, 0.0, NUM };
static Cell retcell ={ OJUMP, JRET, 0, 0, 0.0, NUM, NULL };
Cell *jret = &retcell;
static Cell tempcell ={ OCELL, CTEMP, 0, "", 0.0, NUM|STR|DONTFREE };
static Cell tempcell ={ OCELL, CTEMP, 0, "", 0.0, NUM|STR|DONTFREE, NULL };
Node *curnode = NULL; /* the node being executed, for debugging */
@ -221,7 +221,7 @@ struct Frame *fp = NULL; /* frame pointer. bottom level unused */
Cell *call(Node **a, int n) /* function call. very kludgy and fragile */
{
static Cell newcopycell = { OCELL, CCOPY, 0, "", 0.0, NUM|STR|DONTFREE };
static Cell newcopycell = { OCELL, CCOPY, 0, "", 0.0, NUM|STR|DONTFREE, NULL };
int i, ncall, ndef;
int freed = 0; /* handles potential double freeing when fcn & param share a tempcell */
Node *x;