diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/awk/Makefile | 6 | ||||
-rw-r--r-- | usr.bin/awk/b.c.diff | 53 | ||||
-rw-r--r-- | usr.bin/awk/main.c.diff | 26 | ||||
-rw-r--r-- | usr.bin/awk/run.c.diff | 18 |
4 files changed, 103 insertions, 0 deletions
diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index 1d3642b..87eaa41 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -29,4 +29,10 @@ CLEANFILES+= nawk.1 nawk.1: awk.1 cat ${.ALLSRC} > ${.TARGET} +.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> diff --git a/usr.bin/awk/b.c.diff b/usr.bin/awk/b.c.diff new file mode 100644 index 0000000..2f6b222 --- /dev/null +++ b/usr.bin/awk/b.c.diff @@ -0,0 +1,53 @@ +$FreeBSD$ + +Index: b.c +=================================================================== +RCS file: /home/ncvs/src/contrib/one-true-awk/b.c,v +retrieving revision 1.1.1.8 +diff -u -p -r1.1.1.8 b.c +--- b.c 16 May 2005 19:11:31 -0000 1.1.1.8 ++++ b.c 16 May 2005 19:12:40 -0000 +@@ -282,9 +282,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; +@@ -303,15 +315,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, 0)) + 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 new file mode 100644 index 0000000..a9d2326 --- /dev/null +++ b/usr.bin/awk/main.c.diff @@ -0,0 +1,26 @@ +$FreeBSD$ + +Index: main.c +=================================================================== +RCS file: /home/ncvs/src/contrib/one-true-awk/main.c,v +retrieving revision 1.1.1.10 +diff -u -p -r1.1.1.10 main.c +--- main.c 16 May 2005 19:11:31 -0000 1.1.1.10 ++++ main.c 17 May 2005 14:41:20 -0000 +@@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE + THIS SOFTWARE. + ****************************************************************/ + +-const char *version = "version 20050424"; ++const char *version = "version 20050424 (FreeBSD)"; + + #define DEBUG + #include <stdio.h> +@@ -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) { diff --git a/usr.bin/awk/run.c.diff b/usr.bin/awk/run.c.diff new file mode 100644 index 0000000..d491250 --- /dev/null +++ b/usr.bin/awk/run.c.diff @@ -0,0 +1,18 @@ +$FreeBSD$ + +Index: run.c +=================================================================== +RCS file: /home/ncvs/src/contrib/one-true-awk/run.c,v +retrieving revision 1.1.1.8 +diff -u -p -r1.1.1.8 run.c +--- run.c 16 May 2005 19:11:35 -0000 1.1.1.8 ++++ run.c 16 May 2005 19:12:47 -0000 +@@ -651,7 +651,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); |