Re: awk(1) is locale unaware (was: Re: buildworld breakage during make depend at usr.bin/kdump)

2002-12-03 Thread Andrey A. Chernov
On Wed, Nov 20, 2002 at 14:54:12 +0200, Ruslan Ermilov wrote:

 Index: b.c
 ===
 RCS file: /home/ncvs/src/contrib/one-true-awk/b.c,v
 retrieving revision 1.1.1.2
 diff -u -p -r1.1.1.2 b.c

David, this variant is nice enough. Please, commit.

-- 
Andrey A. Chernov
http://ache.pp.ru/



msg48017/pgp0.pgp
Description: PGP signature


Re: awk(1) is locale unaware (was: Re: buildworld breakage during make depend at usr.bin/kdump)

2002-12-03 Thread Ruslan Ermilov
On Tue, Dec 03, 2002 at 11:09:20AM +0300, Andrey A. Chernov wrote:
 On Wed, Nov 20, 2002 at 14:54:12 +0200, Ruslan Ermilov wrote:
 
  Index: b.c
  ===
  RCS file: /home/ncvs/src/contrib/one-true-awk/b.c,v
  retrieving revision 1.1.1.2
  diff -u -p -r1.1.1.2 b.c
 
 David, this variant is nice enough. Please, commit.
 
One needs to catch up to his email.  :-)

A new version of one-true-awk was released which includes
these fixes.


Cheers,
-- 
Ruslan Ermilov  Sysadmin and DBA,
[EMAIL PROTECTED]   Sunbay Software AG,
[EMAIL PROTECTED]  FreeBSD committer,
+380.652.512.251Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age



msg48021/pgp0.pgp
Description: PGP signature


Re: awk(1) is locale unaware (was: Re: buildworld breakage during make depend at usr.bin/kdump)

2002-11-19 Thread Andrey A. Chernov
On Tue, Nov 19, 2002 at 14:52:02 +0200, Ruslan Ermilov wrote:
 It seems that this patch has never been committed.  This is a critical
 bug that should be fixed before 5.0-RELEASE is out.

I agree. There is no locale yet and I never see that patch.

-- 
Andrey A. Chernov
http://ache.pp.ru/



msg46960/pgp0.pgp
Description: PGP signature


Re: awk(1) is locale unaware (was: Re: buildworld breakage during make depend at usr.bin/kdump)

2002-11-19 Thread Tim Robbins
On Wed, Nov 20, 2002 at 04:38:38AM +0300, Andrey A. Chernov wrote:

 On Tue, Nov 19, 2002 at 14:52:02 +0200, Ruslan Ermilov wrote:
  It seems that this patch has never been committed.  This is a critical
  bug that should be fixed before 5.0-RELEASE is out.
 
 I agree. There is no locale yet and I never see that patch.

This patch seems to work, I used the logic from regcomp.c in libc.
Long lines make it ugly, but it was like that when I got here ;)


Tim


Index: src/usr.bin/awk/Makefile
===
RCS file: /x/freebsd/src/usr.bin/awk/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- src/usr.bin/awk/Makefile10 May 2002 20:36:21 -  1.9
+++ src/usr.bin/awk/Makefile20 Nov 2002 03:13:50 -
@@ -6,7 +6,7 @@
 PROG=  nawk
 SRCS=  awkgram.y b.c lex.c lib.c main.c parse.c proctab.c run.c tran.c ytab.h
 
-CFLAGS+= -I. -I${AWKSRC}
+CFLAGS+= -I. -I${AWKSRC} -I${.CURDIR}/../../lib/libc/locale
 
 DPADD= ${LIBM}
 LDADD= -lm
Index: src/contrib/one-true-awk/b.c
===
RCS file: /x/freebsd/src/contrib/one-true-awk/b.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 b.c
--- src/contrib/one-true-awk/b.c19 Feb 2002 09:35:24 -  1.1.1.2
+++ src/contrib/one-true-awk/b.c20 Nov 2002 03:16:10 -
@@ -32,6 +32,7 @@
 #include stdlib.h
 #include awk.h
 #include ytab.h
+#include collate.h
 
 #defineHAT (NCHARS-2)  /* matches ^ in regular expr */
/* NCHARS is 2**n */
@@ -284,7 +285,7 @@
 
 char *cclenter(char *argp) /* add a character class */
 {
-   int i, c, c2;
+   int i, j, c, c2;
uschar *p = (uschar *) argp;
uschar *op, *bp;
static uschar *buf = 0;
@@ -308,12 +309,24 @@
i--;
continue;
}
-   while (c  c2) {
-   if (!adjbuf((char **) buf, bufsz, bp-buf+2, 
100, (char **) bp, 0))
-   FATAL(out of space for character 
class [%.10s...] 2, p);
-   *bp++ = ++c;
-   i++;
-   }
+   if (__collate_load_error) {
+   while (c  c2) {
+   if (!adjbuf((char **) buf, bufsz, 
+bp-buf+2, 100, (char **) bp, 0))
+   FATAL(out of space for 
+character class [%.10s...] 2, p);
+   *bp++ = ++c;
+   i++;
+   }
+   } else {
+   for (j = CHAR_MIN; j = CHAR_MAX; j++) {
+   if (!adjbuf((char **) buf, bufsz, 
+bp-buf+2, 100, (char **) bp, 0))
+   FATAL(out of space for 
+character class [%.10s...] 2, p);
+   if (__collate_range_cmp(c, j) = 0
+__collate_range_cmp(j, c2) = 
+0) {
+   *bp++ = j;
+   i++;
+   }
+   }
+}
continue;
}
}
Index: src/contrib/one-true-awk/main.c
===
RCS file: /x/freebsd/src/contrib/one-true-awk/main.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 main.c
--- src/contrib/one-true-awk/main.c 16 Mar 2002 16:50:56 -  1.1.1.3
+++ src/contrib/one-true-awk/main.c 20 Nov 2002 03:03:38 -
@@ -27,6 +27,7 @@
 #define DEBUG
 #include stdio.h
 #include ctype.h
+#include locale.h
 #include stdlib.h
 #include string.h
 #include signal.h
@@ -55,6 +56,7 @@
char *fs = NULL;
 
cmdname = argv[0];
+   setlocale(LC_ALL, );
if (argc == 1) {
fprintf(stderr, Usage: %s [-f programfile | 'program'] [-Ffieldsep] 
[-v var=value] [files]\n, cmdname);
exit(1);
Index: src/contrib/one-true-awk/run.c
===
RCS file: /x/freebsd/src/contrib/one-true-awk/run.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 run.c
--- src/contrib/one-true-awk/run.c  19 Feb 2002 09:35:25 -  1.1.1.2
+++ src/contrib/one-true-awk/run.c  20 Nov 2002 03:02:29 -
@@ -1504,11 +1504,11 @@
if (t == FTOUPPER) {
for (p = buf; *p; p++)

Re: awk(1) is locale unaware (was: Re: buildworld breakage during make depend at usr.bin/kdump)

2002-11-19 Thread Andrey A. Chernov
On Wed, Nov 20, 2002 at 14:27:53 +1100, Tim Robbins wrote:
 On Wed, Nov 20, 2002 at 04:38:38AM +0300, Andrey A. Chernov wrote:
 
  On Tue, Nov 19, 2002 at 14:52:02 +0200, Ruslan Ermilov wrote:
   It seems that this patch has never been committed.  This is a critical
   bug that should be fixed before 5.0-RELEASE is out.
  
  I agree. There is no locale yet and I never see that patch.
 
 This patch seems to work, I used the logic from regcomp.c in libc.
 Long lines make it ugly, but it was like that when I got here ;)

Looks good, but it is not enough. Please look in b.c to see how weird 
character classes, i.e. [:alpha:] are implemented there, this stuff must 
be rewritted too.

-- 
Andrey A. Chernov
http://ache.pp.ru/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message