svn commit: r202360 - in stable/8: contrib/one-true-awk usr.bin/awk
Ruslan Ermilov
ru at FreeBSD.org
Fri Jan 15 14:20:02 UTC 2010
Author: ru
Date: Fri Jan 15 14:20:01 2010
New Revision: 202360
URL: http://svn.freebsd.org/changeset/base/202360
Log:
Update to a 26-Nov-2009 release.
Deleted:
stable/8/contrib/one-true-awk/mac.code
stable/8/usr.bin/awk/b.c.diff
stable/8/usr.bin/awk/main.c.diff
stable/8/usr.bin/awk/run.c.diff
Modified:
stable/8/contrib/one-true-awk/FIXES
stable/8/contrib/one-true-awk/b.c
stable/8/contrib/one-true-awk/lib.c
stable/8/contrib/one-true-awk/main.c
stable/8/contrib/one-true-awk/makefile
stable/8/contrib/one-true-awk/maketab.c
stable/8/contrib/one-true-awk/proctab.c
stable/8/contrib/one-true-awk/proto.h
stable/8/contrib/one-true-awk/run.c
stable/8/usr.bin/awk/Makefile
Directory Properties:
stable/8/contrib/one-true-awk/ (props changed)
stable/8/usr.bin/awk/ (props changed)
Modified: stable/8/contrib/one-true-awk/FIXES
==============================================================================
--- stable/8/contrib/one-true-awk/FIXES Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/contrib/one-true-awk/FIXES Fri Jan 15 14:20:01 2010 (r202360)
@@ -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.
+Nov 26, 2009:
+ fixed a long-standing issue with when FS takes effect. a
+ change to FS is now noticed immediately for subsequent splits.
+
+ changed the name getline() to awkgetline() to avoid yet another
+ name conflict somewhere.
+
+Feb 11, 2009:
+ temporarily for now defined HAS_ISBLANK, since that seems to
+ be the best way through the thicket. isblank arrived in C99,
+ but seems to be arriving at different systems at different
+ times.
+
+Oct 8, 2008:
+ fixed typo in b.c that set tmpvec wrongly. no one had ever
+ run into the problem, apparently. thanks to alistair crooks.
+
Oct 23, 2007:
minor fix in lib.c: increase inputFS to 100, change malloc
for fields to n+1.
Modified: stable/8/contrib/one-true-awk/b.c
==============================================================================
--- stable/8/contrib/one-true-awk/b.c Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/contrib/one-true-awk/b.c Fri Jan 15 14:20:01 2010 (r202360)
@@ -24,6 +24,9 @@ THIS SOFTWARE.
/* lasciate ogne speranza, voi ch'intrate. */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#define DEBUG
#include <ctype.h>
@@ -285,9 +288,21 @@ int quoted(char **pp) /* pick up next th
return c;
}
+static int collate_range_cmp(int a, int b)
+{
+ static char s[2][2];
+
+ if ((uschar)a == (uschar)b)
+ return 0;
+ s[0][0] = a;
+ s[1][0] = b;
+ return (strcoll(s[0], s[1]));
+}
+
char *cclenter(const char *argp) /* add a character class */
{
int i, c, c2;
+ int j;
uschar *p = (uschar *) argp;
uschar *op, *bp;
static uschar *buf = 0;
@@ -306,15 +321,18 @@ char *cclenter(const char *argp) /* add
c2 = *p++;
if (c2 == '\\')
c2 = quoted((char **) &p);
- if (c > c2) { /* empty; ignore */
+ if (collate_range_cmp(c, c2) > 0) {
bp--;
i--;
continue;
}
- while (c < c2) {
+ for (j = 0; j < NCHARS; j++) {
+ if ((collate_range_cmp(c, j) > 0) ||
+ collate_range_cmp(j, c2) > 0)
+ continue;
if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1"))
FATAL("out of space for character class [%.10s...] 2", p);
- *bp++ = ++c;
+ *bp++ = j;
i++;
}
continue;
@@ -731,6 +749,7 @@ Node *unary(Node *np)
* to nelson beebe for the suggestion; let's see if it works everywhere.
*/
+/* #define HAS_ISBLANK */
#ifndef HAS_ISBLANK
int (isblank)(int c)
@@ -876,7 +895,7 @@ int cgoto(fa *f, int s, int c)
if (q[j] >= maxsetvec) {
maxsetvec *= 4;
setvec = (int *) realloc(setvec, maxsetvec * sizeof(int));
- tmpset = (int *) realloc(setvec, maxsetvec * sizeof(int));
+ tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int));
if (setvec == 0 || tmpset == 0)
overflo("cgoto overflow");
}
Modified: stable/8/contrib/one-true-awk/lib.c
==============================================================================
--- stable/8/contrib/one-true-awk/lib.c Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/contrib/one-true-awk/lib.c Fri Jan 15 14:20:01 2010 (r202360)
@@ -274,6 +274,7 @@ void fldbld(void) /* create fields from
}
fr = fields;
i = 0; /* number of fields accumulated here */
+ strcpy(inputFS, *FS);
if (strlen(inputFS) > 1) { /* it's a regular expression */
i = refldbld(r, inputFS);
} else if ((sep = *inputFS) == ' ') { /* default whitespace */
Modified: stable/8/contrib/one-true-awk/main.c
==============================================================================
--- stable/8/contrib/one-true-awk/main.c Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/contrib/one-true-awk/main.c Fri Jan 15 14:20:01 2010 (r202360)
@@ -22,7 +22,10 @@ ARISING OUT OF OR IN CONNECTION WITH THE
THIS SOFTWARE.
****************************************************************/
-const char *version = "version 20070501";
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+const char *version = "version 20091126 (FreeBSD)";
#define DEBUG
#include <stdio.h>
@@ -58,6 +61,7 @@ int main(int argc, char *argv[])
const char *fs = NULL;
setlocale(LC_CTYPE, "");
+ setlocale(LC_COLLATE, "");
setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
cmdname = argv[0];
if (argc == 1) {
@@ -86,13 +90,18 @@ int main(int argc, char *argv[])
safe = 1;
break;
case 'f': /* next argument is program filename */
- argc--;
- argv++;
- if (argc <= 1)
- FATAL("no program filename");
- if (npfile >= MAX_PFILE - 1)
- FATAL("too many -f options");
- pfile[npfile++] = argv[1];
+ if (argv[1][2] != 0) { /* arg is -fsomething */
+ if (npfile >= MAX_PFILE - 1)
+ FATAL("too many -f options");
+ pfile[npfile++] = &argv[1][2];
+ } else { /* arg is -f something */
+ argc--; argv++;
+ if (argc <= 1)
+ FATAL("no program filename");
+ if (npfile >= MAX_PFILE - 1)
+ FATAL("too many -f options");
+ pfile[npfile++] = argv[1];
+ }
break;
case 'F': /* set field separator */
if (argv[1][2] != 0) { /* arg is -Fsomething */
@@ -111,8 +120,14 @@ int main(int argc, char *argv[])
WARNING("field separator FS is empty");
break;
case 'v': /* -v a=1 to be done NOW. one -v for each */
- if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1]))
- setclvar(argv[1]);
+ if (argv[1][2] != 0) { /* arg is -vsomething */
+ if (argv[1][2] != 0)
+ setclvar(&argv[1][2]);
+ } else { /* arg is -v something */
+ argc--; argv++;
+ if (argc > 1 && isclvar(argv[1]))
+ setclvar(argv[1]);
+ }
break;
case 'd':
dbg = atoi(&argv[1][2]);
Modified: stable/8/contrib/one-true-awk/makefile
==============================================================================
--- stable/8/contrib/one-true-awk/makefile Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/contrib/one-true-awk/makefile Fri Jan 15 14:20:01 2010 (r202360)
@@ -31,7 +31,6 @@ CC = gcc -fprofile-arcs -ftest-coverage
CC = gcc -Wall -g
CC = cc
CC = gcc -O4
-CC = gcc -Wall -g
YACC = bison -y
Modified: stable/8/contrib/one-true-awk/maketab.c
==============================================================================
--- stable/8/contrib/one-true-awk/maketab.c Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/contrib/one-true-awk/maketab.c Fri Jan 15 14:20:01 2010 (r202360)
@@ -102,7 +102,7 @@ struct xx
{ CALL, "call", "call" },
{ ARG, "arg", "arg" },
{ VARNF, "getnf", "NF" },
- { GETLINE, "getline", "getline" },
+ { GETLINE, "awkgetline", "getline" },
{ 0, "", "" },
};
Modified: stable/8/contrib/one-true-awk/proctab.c
==============================================================================
--- stable/8/contrib/one-true-awk/proctab.c Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/contrib/one-true-awk/proctab.c Fri Jan 15 14:20:01 2010 (r202360)
@@ -180,7 +180,7 @@ Cell *(*proctab[93])(Node **, int) = {
nullproc, /* NUMBER */
nullproc, /* STRING */
nullproc, /* REGEXPR */
- getline, /* GETLINE */
+ awkgetline, /* GETLINE */
substr, /* SUBSTR */
split, /* SPLIT */
jump, /* RETURN */
Modified: stable/8/contrib/one-true-awk/proto.h
==============================================================================
--- stable/8/contrib/one-true-awk/proto.h Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/contrib/one-true-awk/proto.h Fri Jan 15 14:20:01 2010 (r202360)
@@ -149,7 +149,7 @@ extern Cell *call(Node **, int);
extern Cell *copycell(Cell *);
extern Cell *arg(Node **, int);
extern Cell *jump(Node **, int);
-extern Cell *getline(Node **, int);
+extern Cell *awkgetline(Node **, int);
extern Cell *getnf(Node **, int);
extern Cell *array(Node **, int);
extern Cell *awkdelete(Node **, int);
Modified: stable/8/contrib/one-true-awk/run.c
==============================================================================
--- stable/8/contrib/one-true-awk/run.c Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/contrib/one-true-awk/run.c Fri Jan 15 14:20:01 2010 (r202360)
@@ -22,6 +22,9 @@ ARISING OUT OF OR IN CONNECTION WITH THE
THIS SOFTWARE.
****************************************************************/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#define DEBUG
#include <stdio.h>
#include <ctype.h>
@@ -388,7 +391,7 @@ Cell *jump(Node **a, int n) /* break, co
return 0; /* not reached */
}
-Cell *getline(Node **a, int n) /* get next line from specific input */
+Cell *awkgetline(Node **a, int n) /* get next line from specific input */
{ /* a[0] is variable, a[1] is operator, a[2] is filename */
Cell *r, *x;
extern Cell **fldtab;
@@ -653,7 +656,7 @@ Cell *relop(Node **a, int n) /* a[0 < a[
j = x->fval - y->fval;
i = j<0? -1: (j>0? 1: 0);
} else {
- i = strcmp(getsval(x), getsval(y));
+ i = strcoll(getsval(x), getsval(y));
}
tempfree(x);
tempfree(y);
@@ -1159,11 +1162,11 @@ Cell *cat(Node **a, int q) /* a[0] cat a
x->sval, y->sval);
strcpy(s, x->sval);
strcpy(s+n1, y->sval);
+ tempfree(x);
tempfree(y);
z = gettemp();
z->sval = s;
z->tval = STR;
- tempfree(x);
return(z);
}
Modified: stable/8/usr.bin/awk/Makefile
==============================================================================
--- stable/8/usr.bin/awk/Makefile Fri Jan 15 14:05:06 2010 (r202359)
+++ stable/8/usr.bin/awk/Makefile Fri Jan 15 14:20:01 2010 (r202360)
@@ -8,6 +8,8 @@ SRCS= awkgram.y b.c lex.c lib.c main.c p
CFLAGS+= -DHAS_ISBLANK -I. -I${AWKSRC} -DFOPEN_MAX=64
+WARNS?= 1
+
DPADD= ${LIBM}
LDADD= -lm
@@ -25,10 +27,4 @@ proctab.c: maketab
build-tools: maketab
maketab: ytab.h ${AWKSRC}/maketab.c
-.for f in b.c main.c run.c
-${f}: ${AWKSRC}/${f} ${.CURDIR}/${f}.diff
- patch -s -b .orig -o ${.TARGET} < ${.CURDIR}/${f}.diff ${AWKSRC}/${f}
-CLEANFILES+= ${f}
-.endfor
-
.include <bsd.prog.mk>
More information about the svn-src-stable-8
mailing list