diff --git a/contrib/awk/README.DELETED b/contrib/awk/README.DELETED new file mode 100644 index 0000000..e222486 --- /dev/null +++ b/contrib/awk/README.DELETED @@ -0,0 +1,6 @@ +makefile +proctab.c +ytab.c +ytab.h +ytabc.bak +ytabh.bak diff --git a/contrib/awk/README.DRAGONFLY b/contrib/awk/README.DRAGONFLY new file mode 100644 index 0000000..c37cfb8 --- /dev/null +++ b/contrib/awk/README.DRAGONFLY @@ -0,0 +1,17 @@ +ONE TRUE AWK +============ + +Original source is availale from: +http://www.cs.princeton.edu/~bwk/btl.mirror/ + +file = awk.tar.gz +date = 20 December 2012 +size = 88970 +sha1 = 538fd69fb0fd01966eb41ad20c336215b4a07301 + +Note that only the latest tarball is available on B.Kernighan's site. +A list of files removed is in README.DELETED + +Local modifications applied to following files: + run.c + trans.c diff --git a/contrib/awk/run.c b/contrib/awk/run.c index 6c4ce10..b84d72a 100644 --- a/contrib/awk/run.c +++ b/contrib/awk/run.c @@ -1153,13 +1153,13 @@ Cell *cat(Node **a, int q) /* a[0] cat a[1] */ getsval(x); getsval(y); n1 = strlen(x->sval); - n2 = strlen(y->sval); - s = (char *) malloc(n1 + n2 + 1); + n2 = strlen(y->sval) + 1; + s = (char *) malloc(n1 + n2); if (s == NULL) FATAL("out of space concatenating %.15s... and %.15s...", x->sval, y->sval); - strcpy(s, x->sval); - strcpy(s+n1, y->sval); + memmove(s, x->sval, n1); + memmove(s+n1, y->sval, n2); tempfree(x); tempfree(y); z = gettemp(); diff --git a/contrib/awk/tran.c b/contrib/awk/tran.c index a9fa325..da43a3d 100644 --- a/contrib/awk/tran.c +++ b/contrib/awk/tran.c @@ -404,10 +404,9 @@ char *tostring(const char *s) /* make a copy of string s */ { char *p; - p = (char *) malloc(strlen(s)+1); + p = strdup(s); if (p == NULL) FATAL("out of space in tostring on %s", s); - strcpy(p, s); return(p); }