View | Details | Raw Unified | Return to bug 146172
Collapse All | Expand All

(-)nawk/Makefile (-1 / +1 lines)
Lines 7-13 Link Here
7
#
7
#
8
8
9
PORTNAME=	nawk
9
PORTNAME=	nawk
10
PORTVERSION=	20091126
10
PORTVERSION=	20100209
11
CATEGORIES=	lang
11
CATEGORIES=	lang
12
MASTER_SITES=	http://www.cs.princeton.edu/~bwk/btl.mirror/
12
MASTER_SITES=	http://www.cs.princeton.edu/~bwk/btl.mirror/
13
DISTNAME=	awk
13
DISTNAME=	awk
(-)nawk/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (nawk/awk.tar.gz) = ec8545e7c732e4402e963c70ba766a5b
1
MD5 (nawk/awk.tar.gz) = 7e6c71ae36ec48ce1d9160f25174bf77
2
SHA256 (nawk/awk.tar.gz) = 4dbf070864f8ea626ef2b24b2bca6efc8fb372cf6d96fdcf3926663a6e8d0099
2
SHA256 (nawk/awk.tar.gz) = d3b9c2df870d5dc48575fe5c8c5004c73e9ebf124710e83c0e6febdc0df104c1
3
SIZE (nawk/awk.tar.gz) = 117853
3
SIZE (nawk/awk.tar.gz) = 123234
(-)nawk/files/patch-awk.h (+15 lines)
Line 0 Link Here
1
--- awk.h.orig	2004/12/30 01:52:48	1.11
2
+++ awk.h	2008/06/04 14:04:42	1.12
3
@@ -127,6 +127,12 @@
4
 #define	FTOUPPER 12
5
 #define	FTOLOWER 13
6
 #define	FFLUSH	14
7
+#define FAND	15
8
+#define FFOR	16
9
+#define FXOR	17
10
+#define FCOMPL	18
11
+#define FLSHIFT	19
12
+#define FRSHIFT	20
13
 
14
 /* Node:  parse tree is made of nodes, with Cell's at bottom */
15
 
(-)nawk/files/patch-b.c (-67 lines)
Lines 1-67 Link Here
1
--- b.c.orig	2007-03-31 15:56:18.000000000 -0500
2
+++ b.c	2008-07-07 08:44:50.000000000 -0500
3
@@ -84,8 +84,8 @@
4
 
5
 	if (setvec == 0) {	/* first time through any RE */
6
 		maxsetvec = MAXLIN;
7
-		setvec = (int *) malloc(maxsetvec * sizeof(int));
8
-		tmpset = (int *) malloc(maxsetvec * sizeof(int));
9
+		setvec = (int *) calloc(maxsetvec, sizeof(int));
10
+		tmpset = (int *) calloc(maxsetvec, sizeof(int));
11
 		if (setvec == 0 || tmpset == 0)
12
 			overflo("out of space initializing makedfa");
13
 	}
14
@@ -137,7 +137,7 @@
15
 	f->accept = poscnt-1;	/* penter has computed number of positions in re */
16
 	cfoll(f, p1);	/* set up follow sets */
17
 	freetr(p1);
18
-	if ((f->posns[0] = (int *) calloc(1, *(f->re[0].lfollow)*sizeof(int))) == NULL)
19
+	if ((f->posns[0] = (int *) calloc(*(f->re[0].lfollow), sizeof(int))) == NULL)
20
 			overflo("out of space in makedfa");
21
 	if ((f->posns[1] = (int *) calloc(1, sizeof(int))) == NULL)
22
 		overflo("out of space in makedfa");
23
@@ -157,7 +157,7 @@
24
 	f->reset = 0;
25
 	k = *(f->re[0].lfollow);
26
 	xfree(f->posns[2]);			
27
-	if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
28
+	if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
29
 		overflo("out of space in makeinit");
30
 	for (i=0; i <= k; i++) {
31
 		(f->posns[2])[i] = (f->re[0].lfollow)[i];
32
@@ -357,7 +357,7 @@
33
 			setvec[i] = 0;
34
 		setcnt = 0;
35
 		follow(v);	/* computes setvec and setcnt */
36
-		if ((p = (int *) calloc(1, (setcnt+1)*sizeof(int))) == NULL)
37
+		if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL)
38
 			overflo("out of space building follow set");
39
 		f->re[info(v)].lfollow = p;
40
 		*p = setcnt;
41
@@ -531,7 +531,7 @@
42
 			for (i = 2; i <= f->curstat; i++)
43
 				xfree(f->posns[i]);
44
 			k = *f->posns[0];			
45
-			if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
46
+			if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
47
 				overflo("out of space in pmatch");
48
 			for (i = 0; i <= k; i++)
49
 				(f->posns[2])[i] = (f->posns[0])[i];
50
@@ -588,7 +588,7 @@
51
 			for (i = 2; i <= f->curstat; i++)
52
 				xfree(f->posns[i]);
53
 			k = *f->posns[0];			
54
-			if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
55
+			if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
56
 				overflo("out of state space");
57
 			for (i = 0; i <= k; i++)
58
 				(f->posns[2])[i] = (f->posns[0])[i];
59
@@ -920,7 +920,7 @@
60
 	for (i = 0; i < NCHARS; i++)
61
 		f->gototab[f->curstat][i] = 0;
62
 	xfree(f->posns[f->curstat]);
63
-	if ((p = (int *) calloc(1, (setcnt+1)*sizeof(int))) == NULL)
64
+	if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL)
65
 		overflo("out of space in cgoto");
66
 
67
 	f->posns[f->curstat] = p;
(-)nawk/files/patch-lex.c (+39 lines)
Line 0 Link Here
1
--- lex.c.orig	2006/04/16 02:10:18	1.9
2
+++ lex.c	2008/06/04 14:04:42	1.10
3
@@ -48,9 +48,11 @@
4
 	{ "BEGIN",	XBEGIN,		XBEGIN },
5
 	{ "END",	XEND,		XEND },
6
 	{ "NF",		VARNF,		VARNF },
7
+	{ "and",	FAND,		BLTIN },
8
 	{ "atan2",	FATAN,		BLTIN },
9
 	{ "break",	BREAK,		BREAK },
10
 	{ "close",	CLOSE,		CLOSE },
11
+	{ "compl",	FCOMPL,		BLTIN },
12
 	{ "continue",	CONTINUE,	CONTINUE },
13
 	{ "cos",	FCOS,		BLTIN },
14
 	{ "delete",	DELETE,		DELETE },
15
@@ -70,13 +72,16 @@
16
 	{ "int",	FINT,		BLTIN },
17
 	{ "length",	FLENGTH,	BLTIN },
18
 	{ "log",	FLOG,		BLTIN },
19
+	{ "lshift",	FLSHIFT,	BLTIN },
20
 	{ "match",	MATCHFCN,	MATCHFCN },
21
 	{ "next",	NEXT,		NEXT },
22
 	{ "nextfile",	NEXTFILE,	NEXTFILE },
23
+	{ "or",		FFOR,		BLTIN },
24
 	{ "print",	PRINT,		PRINT },
25
 	{ "printf",	PRINTF,		PRINTF },
26
 	{ "rand",	FRAND,		BLTIN },
27
 	{ "return",	RETURN,		RETURN },
28
+	{ "rshift",	FRSHIFT,	BLTIN },
29
 	{ "sin",	FSIN,		BLTIN },
30
 	{ "split",	SPLIT,		SPLIT },
31
 	{ "sprintf",	SPRINTF,	SPRINTF },
32
@@ -88,6 +93,7 @@
33
 	{ "tolower",	FTOLOWER,	BLTIN },
34
 	{ "toupper",	FTOUPPER,	BLTIN },
35
 	{ "while",	WHILE,		WHILE },
36
+	{ "xor",	FXOR,		BLTIN },
37
 };
38
 
39
 #define DEBUG
(-)nawk/files/patch-lib.c (-29 lines)
Lines 1-29 Link Here
1
--- lib.c.orig	2007-10-22 18:17:52.000000000 -0500
2
+++ lib.c	2008-07-07 09:38:58.000000000 -0500
3
@@ -59,7 +59,7 @@
4
 {
5
 	if ( (record = (char *) malloc(n)) == NULL
6
 	  || (fields = (char *) malloc(n+1)) == NULL
7
-	  || (fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *))) == NULL
8
+	  || (fldtab = (Cell **) calloc((nfields+1), sizeof(Cell *))) == NULL
9
 	  || (fldtab[0] = (Cell *) malloc(sizeof(Cell))) == NULL )
10
 		FATAL("out of space for $0 and fields");
11
 	*fldtab[0] = dollar0;
12
@@ -78,7 +78,7 @@
13
 		if (fldtab[i] == NULL)
14
 			FATAL("out of space in makefields %d", i);
15
 		*fldtab[i] = dollar1;
16
-		sprintf(temp, "%d", i);
17
+		snprintf(temp, sizeof temp, "%d", i);
18
 		fldtab[i]->nval = tostring(temp);
19
 	}
20
 }
21
@@ -226,7 +226,7 @@
22
 	char *s, temp[50];
23
 	extern Array *ARGVtab;
24
 
25
-	sprintf(temp, "%d", n);
26
+	snprintf(temp, sizeof temp, "%d", n);
27
 	x = setsymtab(temp, "", 0.0, STR, ARGVtab);
28
 	s = getsval(x);
29
 	   dprintf( ("getargv(%d) returns |%s|\n", n, s) );
(-)nawk/files/patch-proto.h (+10 lines)
Line 0 Link Here
1
--- proto.h.orig	2003/10/26 11:34:23	1.5
2
+++ proto.h	2007/11/06 23:07:52	1.5.22.1
3
@@ -112,6 +112,7 @@ extern	double	getfval(Cell *);
4
 extern	char	*getsval(Cell *);
5
 extern	char	*getpssval(Cell *);     /* for print */
6
 extern	char	*tostring(const char *);
7
+extern	char	*tostringN(const char *, size_t n);
8
 extern	char	*qstring(const char *, int);
9
 
10
 extern	void	recinit(unsigned int);
(-)nawk/files/patch-run.c (-3 / +66 lines)
Lines 1-6 Link Here
1
--- run.c.orig	Mon Dec  6 06:44:42 2004
1
--- run.c.orig	2009-11-26 23:59:16.000000000 +0000
2
+++ run.c	Sat Feb 26 18:01:46 2005
2
+++ run.c	2010-04-29 22:50:49.000000000 +0000
3
@@ -1507,15 +1507,15 @@
3
@@ -1504,20 +1504,78 @@
4
 			nextarg = nextarg->nnext;
5
 		}
6
 		break;
7
+	case FCOMPL:
8
+		u = ~((int)getfval(x));
9
+		break;
10
+	case FAND:
11
+		if (nextarg == 0) {
12
+			WARNING("and requires two arguments; returning 0");
13
+			u = 0;
14
+			break;
15
+		}
16
+		y = execute(a[1]->nnext);
17
+		u = ((int)getfval(x)) & ((int)getfval(y));
18
+		tempfree(y);
19
+		nextarg = nextarg->nnext;
20
+		break;
21
+	case FFOR:
22
+		if (nextarg == 0) {
23
+			WARNING("or requires two arguments; returning 0");
24
+			u = 0;
25
+			break;
26
+		}
27
+		y = execute(a[1]->nnext);
28
+		u = ((int)getfval(x)) | ((int)getfval(y));
29
+		tempfree(y);
30
+		nextarg = nextarg->nnext;
31
+		break;
32
+	case FXOR:
33
+		if (nextarg == 0) {
34
+			WARNING("or requires two arguments; returning 0");
35
+			u = 0;
36
+			break;
37
+		}
38
+		y = execute(a[1]->nnext);
39
+		u = ((int)getfval(x)) ^ ((int)getfval(y));
40
+		tempfree(y);
41
+		nextarg = nextarg->nnext;
42
+		break;
43
+	case FLSHIFT:
44
+		if (nextarg == 0) {
45
+			WARNING("or requires two arguments; returning 0");
46
+			u = 0;
47
+			break;
48
+		}
49
+		y = execute(a[1]->nnext);
50
+		u = ((int)getfval(x)) << ((int)getfval(y));
51
+		tempfree(y);
52
+		nextarg = nextarg->nnext;
53
+		break;
54
+	case FRSHIFT:
55
+		if (nextarg == 0) {
56
+			WARNING("or requires two arguments; returning 0");
57
+			u = 0;
58
+			break;
59
+		}
60
+		y = execute(a[1]->nnext);
61
+		u = ((int)getfval(x)) >> ((int)getfval(y));
62
+		tempfree(y);
63
+		nextarg = nextarg->nnext;
64
+		break;
65
 	case FSYSTEM:
66
 		fflush(stdout);		/* in case something is buffered already */
4
 		u = (Awkfloat) system(getsval(x)) / 256;   /* 256 is unix-dep */
67
 		u = (Awkfloat) system(getsval(x)) / 256;   /* 256 is unix-dep */
5
 		break;
68
 		break;
6
 	case FRAND:
69
 	case FRAND:

Return to bug 146172