From 270ba02de1ffa85c9293d73669cae997f42c62b1 Mon Sep 17 00:00:00 2001 From: ru Date: Sun, 10 Jan 2010 08:02:07 +0000 Subject: Apply patches directly to sources. Their effect is as follows: - Make one-true-awk respect locale's collating order in [a-z] bracket expressions, until a more complete fix (like handing BREs) is ready. - Don't require a space between -[fv] and its argument. --- usr.bin/awk/Makefile | 6 ----- usr.bin/awk/b.c.diff | 50 ------------------------------------- usr.bin/awk/main.c.diff | 66 ------------------------------------------------- usr.bin/awk/run.c.diff | 15 ----------- 4 files changed, 137 deletions(-) delete mode 100644 usr.bin/awk/b.c.diff delete mode 100644 usr.bin/awk/main.c.diff delete mode 100644 usr.bin/awk/run.c.diff (limited to 'usr.bin') diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index 2812615..6538636 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -27,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 diff --git a/usr.bin/awk/b.c.diff b/usr.bin/awk/b.c.diff deleted file mode 100644 index 5b4905e..0000000 --- a/usr.bin/awk/b.c.diff +++ /dev/null @@ -1,50 +0,0 @@ -$FreeBSD$ - -Index: b.c -=================================================================== ---- b.c (revision 201951) -+++ b.c (working copy) -@@ -285,9 +285,21 @@ int quoted(char **pp) /* pick up next thing after - 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 +318,18 @@ char *cclenter(const char *argp) /* add a characte - 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; diff --git a/usr.bin/awk/main.c.diff b/usr.bin/awk/main.c.diff deleted file mode 100644 index 325efff..0000000 --- a/usr.bin/awk/main.c.diff +++ /dev/null @@ -1,66 +0,0 @@ -$FreeBSD$ - -Index: main.c -=================================================================== ---- main.c (revision 201951) -+++ main.c (working copy) -@@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PE - THIS SOFTWARE. - ****************************************************************/ - --const char *version = "version 20091126"; -+const char *version = "version 20091126 (FreeBSD)"; - - #define DEBUG - #include -@@ -58,6 +58,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 +87,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 +117,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]); diff --git a/usr.bin/awk/run.c.diff b/usr.bin/awk/run.c.diff deleted file mode 100644 index c0924ea..0000000 --- a/usr.bin/awk/run.c.diff +++ /dev/null @@ -1,15 +0,0 @@ -$FreeBSD$ - -Index: run.c -=================================================================== ---- run.c (revision 201951) -+++ run.c (working copy) -@@ -653,7 +653,7 @@ Cell *relop(Node **a, int n) /* a[0 < a[1], etc. * - 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); -- cgit v1.1