ports/146172: Update lang/nawk to 20100209

Pedro Giffuni giffunip at tutopia.com
Fri Apr 30 04:10:03 UTC 2010


>Number:         146172
>Category:       ports
>Synopsis:       Update lang/nawk to 20100209
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 30 04:10:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Pedro Giffuni
>Release:        8.0-Release
>Organization:
>Environment:
FreeBSD mogwai.giffuni.net 8.0-RELEASE FreeBSD 8.0-RELEASE #13: Sat Jan  9 20:39:47 UTC 2010     pedro at mogwai.giffuni.net:/usr/src/sys/i386/compile/GENERIC  i386

>Description:
- Update to 20100209: minor change according to FIXES:
	i give up.  replaced isblank with isspace in b.c; there are
	no consistent header files.
- Remove calloc, snprintf patches, they were never considered
 important upstream.
- Old patches from OpenBSD to extend awk with bitwise operations (based on gawk).
>How-To-Repeat:

>Fix:
diff -ruN nawk.orig/Makefile nawk/Makefile
--- nawk.orig/Makefile	2010-04-29 22:26:35.000000000 +0000
+++ nawk/Makefile	2010-04-29 23:02:42.000000000 +0000
@@ -7,7 +7,7 @@
 #
 
 PORTNAME=	nawk
-PORTVERSION=	20091126
+PORTVERSION=	20100209
 CATEGORIES=	lang
 MASTER_SITES=	http://www.cs.princeton.edu/~bwk/btl.mirror/
 DISTNAME=	awk
diff -ruN nawk.orig/distinfo nawk/distinfo
--- nawk.orig/distinfo	2010-04-29 22:26:35.000000000 +0000
+++ nawk/distinfo	2010-04-29 22:28:26.000000000 +0000
@@ -1,3 +1,3 @@
-MD5 (nawk/awk.tar.gz) = ec8545e7c732e4402e963c70ba766a5b
-SHA256 (nawk/awk.tar.gz) = 4dbf070864f8ea626ef2b24b2bca6efc8fb372cf6d96fdcf3926663a6e8d0099
-SIZE (nawk/awk.tar.gz) = 117853
+MD5 (nawk/awk.tar.gz) = 7e6c71ae36ec48ce1d9160f25174bf77
+SHA256 (nawk/awk.tar.gz) = d3b9c2df870d5dc48575fe5c8c5004c73e9ebf124710e83c0e6febdc0df104c1
+SIZE (nawk/awk.tar.gz) = 123234
diff -ruN nawk.orig/files/patch-awk.h nawk/files/patch-awk.h
--- nawk.orig/files/patch-awk.h	1970-01-01 00:00:00.000000000 +0000
+++ nawk/files/patch-awk.h	2010-04-29 22:41:07.000000000 +0000
@@ -0,0 +1,15 @@
+--- awk.h.orig	2004/12/30 01:52:48	1.11
++++ awk.h	2008/06/04 14:04:42	1.12
+@@ -127,6 +127,12 @@
+ #define	FTOUPPER 12
+ #define	FTOLOWER 13
+ #define	FFLUSH	14
++#define FAND	15
++#define FFOR	16
++#define FXOR	17
++#define FCOMPL	18
++#define FLSHIFT	19
++#define FRSHIFT	20
+ 
+ /* Node:  parse tree is made of nodes, with Cell's at bottom */
+ 
diff -ruN nawk.orig/files/patch-b.c nawk/files/patch-b.c
--- nawk.orig/files/patch-b.c	2010-04-29 22:26:35.000000000 +0000
+++ nawk/files/patch-b.c	1970-01-01 00:00:00.000000000 +0000
@@ -1,67 +0,0 @@
---- 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 -ruN nawk.orig/files/patch-lex.c nawk/files/patch-lex.c
--- nawk.orig/files/patch-lex.c	1970-01-01 00:00:00.000000000 +0000
+++ nawk/files/patch-lex.c	2010-04-29 22:41:07.000000000 +0000
@@ -0,0 +1,39 @@
+--- lex.c.orig	2006/04/16 02:10:18	1.9
++++ lex.c	2008/06/04 14:04:42	1.10
+@@ -48,9 +48,11 @@
+ 	{ "BEGIN",	XBEGIN,		XBEGIN },
+ 	{ "END",	XEND,		XEND },
+ 	{ "NF",		VARNF,		VARNF },
++	{ "and",	FAND,		BLTIN },
+ 	{ "atan2",	FATAN,		BLTIN },
+ 	{ "break",	BREAK,		BREAK },
+ 	{ "close",	CLOSE,		CLOSE },
++	{ "compl",	FCOMPL,		BLTIN },
+ 	{ "continue",	CONTINUE,	CONTINUE },
+ 	{ "cos",	FCOS,		BLTIN },
+ 	{ "delete",	DELETE,		DELETE },
+@@ -70,13 +72,16 @@
+ 	{ "int",	FINT,		BLTIN },
+ 	{ "length",	FLENGTH,	BLTIN },
+ 	{ "log",	FLOG,		BLTIN },
++	{ "lshift",	FLSHIFT,	BLTIN },
+ 	{ "match",	MATCHFCN,	MATCHFCN },
+ 	{ "next",	NEXT,		NEXT },
+ 	{ "nextfile",	NEXTFILE,	NEXTFILE },
++	{ "or",		FFOR,		BLTIN },
+ 	{ "print",	PRINT,		PRINT },
+ 	{ "printf",	PRINTF,		PRINTF },
+ 	{ "rand",	FRAND,		BLTIN },
+ 	{ "return",	RETURN,		RETURN },
++	{ "rshift",	FRSHIFT,	BLTIN },
+ 	{ "sin",	FSIN,		BLTIN },
+ 	{ "split",	SPLIT,		SPLIT },
+ 	{ "sprintf",	SPRINTF,	SPRINTF },
+@@ -88,6 +93,7 @@
+ 	{ "tolower",	FTOLOWER,	BLTIN },
+ 	{ "toupper",	FTOUPPER,	BLTIN },
+ 	{ "while",	WHILE,		WHILE },
++	{ "xor",	FXOR,		BLTIN },
+ };
+ 
+ #define DEBUG
diff -ruN nawk.orig/files/patch-lib.c nawk/files/patch-lib.c
--- nawk.orig/files/patch-lib.c	2010-04-29 22:26:35.000000000 +0000
+++ nawk/files/patch-lib.c	1970-01-01 00:00:00.000000000 +0000
@@ -1,29 +0,0 @@
---- 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 -ruN nawk.orig/files/patch-proto.h nawk/files/patch-proto.h
--- nawk.orig/files/patch-proto.h	1970-01-01 00:00:00.000000000 +0000
+++ nawk/files/patch-proto.h	2010-04-29 22:41:07.000000000 +0000
@@ -0,0 +1,10 @@
+--- proto.h.orig	2003/10/26 11:34:23	1.5
++++ proto.h	2007/11/06 23:07:52	1.5.22.1
+@@ -112,6 +112,7 @@ extern	double	getfval(Cell *);
+ extern	char	*getsval(Cell *);
+ extern	char	*getpssval(Cell *);     /* for print */
+ extern	char	*tostring(const char *);
++extern	char	*tostringN(const char *, size_t n);
+ extern	char	*qstring(const char *, int);
+ 
+ extern	void	recinit(unsigned int);
diff -ruN nawk.orig/files/patch-run.c nawk/files/patch-run.c
--- nawk.orig/files/patch-run.c	2010-04-29 22:26:35.000000000 +0000
+++ nawk/files/patch-run.c	2010-04-29 22:51:38.000000000 +0000
@@ -1,6 +1,69 @@
---- run.c.orig	Mon Dec  6 06:44:42 2004
-+++ run.c	Sat Feb 26 18:01:46 2005
-@@ -1507,15 +1507,15 @@
+--- run.c.orig	2009-11-26 23:59:16.000000000 +0000
++++ run.c	2010-04-29 22:50:49.000000000 +0000
+@@ -1504,20 +1504,78 @@
+ 			nextarg = nextarg->nnext;
+ 		}
+ 		break;
++	case FCOMPL:
++		u = ~((int)getfval(x));
++		break;
++	case FAND:
++		if (nextarg == 0) {
++			WARNING("and requires two arguments; returning 0");
++			u = 0;
++			break;
++		}
++		y = execute(a[1]->nnext);
++		u = ((int)getfval(x)) & ((int)getfval(y));
++		tempfree(y);
++		nextarg = nextarg->nnext;
++		break;
++	case FFOR:
++		if (nextarg == 0) {
++			WARNING("or requires two arguments; returning 0");
++			u = 0;
++			break;
++		}
++		y = execute(a[1]->nnext);
++		u = ((int)getfval(x)) | ((int)getfval(y));
++		tempfree(y);
++		nextarg = nextarg->nnext;
++		break;
++	case FXOR:
++		if (nextarg == 0) {
++			WARNING("or requires two arguments; returning 0");
++			u = 0;
++			break;
++		}
++		y = execute(a[1]->nnext);
++		u = ((int)getfval(x)) ^ ((int)getfval(y));
++		tempfree(y);
++		nextarg = nextarg->nnext;
++		break;
++	case FLSHIFT:
++		if (nextarg == 0) {
++			WARNING("or requires two arguments; returning 0");
++			u = 0;
++			break;
++		}
++		y = execute(a[1]->nnext);
++		u = ((int)getfval(x)) << ((int)getfval(y));
++		tempfree(y);
++		nextarg = nextarg->nnext;
++		break;
++	case FRSHIFT:
++		if (nextarg == 0) {
++			WARNING("or requires two arguments; returning 0");
++			u = 0;
++			break;
++		}
++		y = execute(a[1]->nnext);
++		u = ((int)getfval(x)) >> ((int)getfval(y));
++		tempfree(y);
++		nextarg = nextarg->nnext;
++		break;
+ 	case FSYSTEM:
+ 		fflush(stdout);		/* in case something is buffered already */
  		u = (Awkfloat) system(getsval(x)) / 256;   /* 256 is unix-dep */
  		break;
  	case FRAND:


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list