cvs commit: src/contrib/one-true-awk - Imported sources
Ruslan Ermilov
ru at FreeBSD.ORG
Mon May 16 12:35:07 PDT 2005
On Mon, May 16, 2005 at 11:25:05PM +0400, Andrey Chernov wrote:
> On Mon, May 16, 2005 at 07:11:39PM +0000, Ruslan Ermilov wrote:
> > ru 2005-05-16 19:11:39 UTC
> >
> > FreeBSD src repository
> >
> > src/contrib/one-true-awk - Imported sources
> > Update of /home/ncvs/src/contrib/one-true-awk
> > In directory repoman.freebsd.org:/tmp/cvs-serv34626
> >
> > Log Message:
> > Vendor import of bwk's 24-Apr-2005 release.
>
> Is it fix [a-z]-type collating ranges? Even GNU regex now honors it
> natively.
>
Nope, but I still keep the patches locally (attached).
Cheers,
--
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
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:33:25 -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;
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 16 May 2005 19:33:25 -0000
@@ -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) {
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:33:36 -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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20050516/76b4c302/attachment.bin
More information about the cvs-src
mailing list