Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2005 22:35:16 +0300
From:      Ruslan Ermilov <ru@FreeBSD.ORG>
To:        Andrey Chernov <ache@nagual.pp.ru>, src-committers@FreeBSD.ORG, cvs-src@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/contrib/one-true-awk - Imported sources
Message-ID:  <20050516193516.GA14960@ip.net.ua>
In-Reply-To: <20050516192505.GA11854@nagual.pp.ru>
References:  <200505161911.j4GJBdQS034729@repoman.freebsd.org> <20050516192505.GA11854@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

--O5XBE6gyVG5Rl6Rj
Content-Type: multipart/mixed; boundary="YZ5djTAD1cGYuMQK"
Content-Disposition: inline


--YZ5djTAD1cGYuMQK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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
> >=20
> >   FreeBSD src repository
> >=20
> >   src/contrib/one-true-awk - Imported sources
> >   Update of /home/ncvs/src/contrib/one-true-awk
> >   In directory repoman.freebsd.org:/tmp/cvs-serv34626
> >  =20
> >   Log Message:
> >   Vendor import of bwk's 24-Apr-2005 release.
>=20
> Is it fix [a-z]-type collating ranges? Even GNU regex now honors it=20
> natively.
>=20
Nope, but I still keep the patches locally (attached).


Cheers,
--=20
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

--YZ5djTAD1cGYuMQK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=p
Content-Transfer-Encoding: quoted-printable

Index: b.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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;
 }
=20
+static int collate_range_cmp(int a, int b)
+{
+	static char s[2][2];
+
+	if ((uschar)a =3D=3D (uschar)b)
+		return 0;
+	s[0][0] =3D a;
+	s[1][0] =3D b;
+	return (strcoll(s[0], s[1]));
+}
+
 char *cclenter(const char *argp)	/* add a character class */
 {
 	int i, c, c2;
+	int j;
 	uschar *p =3D (uschar *) argp;
 	uschar *op, *bp;
 	static uschar *buf =3D 0;
@@ -303,15 +315,18 @@ char *cclenter(const char *argp)	/* add=20
 				c2 =3D *p++;
 				if (c2 =3D=3D '\\')
 					c2 =3D quoted((char **) &p);
-				if (c > c2) {	/* empty; ignore */
+				if (collate_range_cmp(c, c2) > 0) {
 					bp--;
 					i--;
 					continue;
 				}
-				while (c < c2) {
+				for (j =3D 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++ =3D ++c;
+					*bp++ =3D j;
 					i++;
 				}
 				continue;
Index: main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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 =3D NULL;
=20
 	setlocale(LC_CTYPE, "");
+	setlocale(LC_COLLATE, "");
 	setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
 	cmdname =3D argv[0];
 	if (argc =3D=3D 1) {
Index: run.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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 =3D x->fval - y->fval;
 		i =3D j<0? -1: (j>0? 1: 0);
 	} else {
-		i =3D strcmp(getsval(x), getsval(y));
+		i =3D strcoll(getsval(x), getsval(y));
 	}
 	tempfree(x);
 	tempfree(y);

--YZ5djTAD1cGYuMQK--

--O5XBE6gyVG5Rl6Rj
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQFCiPX0qRfpzJluFF4RAr9fAKCXbdZmi95T9QevkyLc8hf5t51TdwCeNrHE
JGBMpGkrsNzyHvzHKiXCMIM=
=bqd9
-----END PGP SIGNATURE-----

--O5XBE6gyVG5Rl6Rj--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050516193516.GA14960>