aboutsummaryrefslogtreecommitdiff
path: root/lang/nawk
diff options
context:
space:
mode:
authorStefan Walter <stefan@FreeBSD.org>2008-10-20 14:52:28 +0000
committerStefan Walter <stefan@FreeBSD.org>2008-10-20 14:52:28 +0000
commit76464cb48c94b2d5e38e1e697a1191fb5d92cb17 (patch)
tree2c993ba8bfcca43debd12d81b1faf49b7f560b45 /lang/nawk
parent3b83752c6d2a371e41a3492fa01faa5f6335d1c2 (diff)
downloadports-76464cb48c94b2d5e38e1e697a1191fb5d92cb17.tar.gz
ports-76464cb48c94b2d5e38e1e697a1191fb5d92cb17.zip
Notes
Diffstat (limited to 'lang/nawk')
-rw-r--r--lang/nawk/Makefile1
-rw-r--r--lang/nawk/files/patch-b.c67
-rw-r--r--lang/nawk/files/patch-lib.c29
-rw-r--r--lang/nawk/files/patch-main.c19
-rw-r--r--lang/nawk/files/patch-tran.c23
5 files changed, 139 insertions, 0 deletions
diff --git a/lang/nawk/Makefile b/lang/nawk/Makefile
index b27362d50e0f..fad4ffdace4c 100644
--- a/lang/nawk/Makefile
+++ b/lang/nawk/Makefile
@@ -8,6 +8,7 @@
PORTNAME= nawk
PORTVERSION= 20071023
+PORTREVISION= 1
CATEGORIES= lang
MASTER_SITES= http://www.cs.princeton.edu/~bwk/btl.mirror/
DISTNAME= awk
diff --git a/lang/nawk/files/patch-b.c b/lang/nawk/files/patch-b.c
new file mode 100644
index 000000000000..6ed634861b0b
--- /dev/null
+++ b/lang/nawk/files/patch-b.c
@@ -0,0 +1,67 @@
+--- b.c.orig 2007-03-31 15:56:18.000000000 -0500
++++ b.c 2008-07-07 08:44:50.000000000 -0500
+@@ -84,8 +84,8 @@
+
+ if (setvec == 0) { /* first time through any RE */
+ maxsetvec = MAXLIN;
+- setvec = (int *) malloc(maxsetvec * sizeof(int));
+- tmpset = (int *) malloc(maxsetvec * sizeof(int));
++ setvec = (int *) calloc(maxsetvec, sizeof(int));
++ tmpset = (int *) calloc(maxsetvec, sizeof(int));
+ if (setvec == 0 || tmpset == 0)
+ overflo("out of space initializing makedfa");
+ }
+@@ -137,7 +137,7 @@
+ f->accept = poscnt-1; /* penter has computed number of positions in re */
+ cfoll(f, p1); /* set up follow sets */
+ freetr(p1);
+- if ((f->posns[0] = (int *) calloc(1, *(f->re[0].lfollow)*sizeof(int))) == NULL)
++ if ((f->posns[0] = (int *) calloc(*(f->re[0].lfollow), sizeof(int))) == NULL)
+ overflo("out of space in makedfa");
+ if ((f->posns[1] = (int *) calloc(1, sizeof(int))) == NULL)
+ overflo("out of space in makedfa");
+@@ -157,7 +157,7 @@
+ f->reset = 0;
+ k = *(f->re[0].lfollow);
+ xfree(f->posns[2]);
+- if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
++ if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
+ overflo("out of space in makeinit");
+ for (i=0; i <= k; i++) {
+ (f->posns[2])[i] = (f->re[0].lfollow)[i];
+@@ -357,7 +357,7 @@
+ setvec[i] = 0;
+ setcnt = 0;
+ follow(v); /* computes setvec and setcnt */
+- if ((p = (int *) calloc(1, (setcnt+1)*sizeof(int))) == NULL)
++ if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL)
+ overflo("out of space building follow set");
+ f->re[info(v)].lfollow = p;
+ *p = setcnt;
+@@ -531,7 +531,7 @@
+ for (i = 2; i <= f->curstat; i++)
+ xfree(f->posns[i]);
+ k = *f->posns[0];
+- if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
++ 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];
+@@ -588,7 +588,7 @@
+ for (i = 2; i <= f->curstat; i++)
+ xfree(f->posns[i]);
+ k = *f->posns[0];
+- if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
++ 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];
+@@ -920,7 +920,7 @@
+ for (i = 0; i < NCHARS; i++)
+ f->gototab[f->curstat][i] = 0;
+ xfree(f->posns[f->curstat]);
+- if ((p = (int *) calloc(1, (setcnt+1)*sizeof(int))) == NULL)
++ if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL)
+ overflo("out of space in cgoto");
+
+ f->posns[f->curstat] = p;
diff --git a/lang/nawk/files/patch-lib.c b/lang/nawk/files/patch-lib.c
new file mode 100644
index 000000000000..242068fd485e
--- /dev/null
+++ b/lang/nawk/files/patch-lib.c
@@ -0,0 +1,29 @@
+--- lib.c.orig 2007-10-22 18:17:52.000000000 -0500
++++ lib.c 2008-07-07 09:38:58.000000000 -0500
+@@ -59,7 +59,7 @@
+ {
+ if ( (record = (char *) malloc(n)) == NULL
+ || (fields = (char *) malloc(n+1)) == NULL
+- || (fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *))) == NULL
++ || (fldtab = (Cell **) calloc((nfields+1), sizeof(Cell *))) == NULL
+ || (fldtab[0] = (Cell *) malloc(sizeof(Cell))) == NULL )
+ FATAL("out of space for $0 and fields");
+ *fldtab[0] = dollar0;
+@@ -78,7 +78,7 @@
+ if (fldtab[i] == NULL)
+ FATAL("out of space in makefields %d", i);
+ *fldtab[i] = dollar1;
+- sprintf(temp, "%d", i);
++ snprintf(temp, sizeof temp, "%d", i);
+ fldtab[i]->nval = tostring(temp);
+ }
+ }
+@@ -226,7 +226,7 @@
+ char *s, temp[50];
+ extern Array *ARGVtab;
+
+- sprintf(temp, "%d", n);
++ snprintf(temp, sizeof temp, "%d", n);
+ x = setsymtab(temp, "", 0.0, STR, ARGVtab);
+ s = getsval(x);
+ dprintf( ("getargv(%d) returns |%s|\n", n, s) );
diff --git a/lang/nawk/files/patch-main.c b/lang/nawk/files/patch-main.c
new file mode 100644
index 000000000000..216f75e8d550
--- /dev/null
+++ b/lang/nawk/files/patch-main.c
@@ -0,0 +1,19 @@
+--- main.c.orig 2007-05-01 16:05:28.000000000 -0500
++++ main.c 2008-07-08 15:33:37.000000000 -0500
+@@ -34,6 +34,8 @@
+ #include "awk.h"
+ #include "ytab.h"
+
++#include <fenv.h>
++
+ extern char **environ;
+ extern int nfields;
+
+@@ -67,6 +69,7 @@
+ exit(1);
+ }
+ signal(SIGFPE, fpecatch);
++ feenableexcept(FE_DIVBYZERO|FE_INEXACT|FE_OVERFLOW);
+ yyin = NULL;
+ symtab = makesymtab(NSYMTAB/NSYMTAB);
+ while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') {
diff --git a/lang/nawk/files/patch-tran.c b/lang/nawk/files/patch-tran.c
new file mode 100644
index 000000000000..94ae657a6eca
--- /dev/null
+++ b/lang/nawk/files/patch-tran.c
@@ -0,0 +1,23 @@
+diff -u -p -r1.6 -r1.9.10.1
+--- tran.c.orig 2005/07/03 15:18:11 1.6
++++ tran.c 2007/11/06 23:07:52 1.9.10.1
+@@ -210,7 +210,10 @@ Cell *setsymtab(const char *n, const cha
+ int h;
+ Cell *p;
+
+- if (n != NULL && (p = lookup(n, tp)) != NULL) {
++ if (n == NULL)
++ n = "";
++
++ if ((p = lookup(n, tp)) != NULL) {
+ dprintf( ("setsymtab found %p: n=%s s=\"%s\" f=%g t=%o\n",
+ p, NN(p->nval), NN(p->sval), p->fval, p->tval) );
+ return(p);
+@@ -282,6 +285,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f) /
+ {
+ int fldno;
+
++ f += 0.0; /* normalise negative zero to positive zero */
+ if ((vp->tval & (NUM | STR)) == 0)
+ funnyvar(vp, "assign to");
+ if (isfld(vp)) {