Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
From:
Aharon Robbins
Subject:
Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
Date:
Thu, 27 Jun 2013 16:46:36 +0300
User-agent:
Heirloom mailx 12.5 6/20/10
> Date: Thu, 27 Jun 2013 15:27:40 +0200
> From: Paolo Bonzini <bonzini@gnu.org>
> Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
>
> Right now only gawk is different from the others, and not in a very
> clean manner:
>
> #ifndef GAWK
> /* Defer to the system regex library about the meaning
> of range expressions. */
> regex_t re;
> char pattern[6] = { '[', 0, '-', 0, ']', 0 };
> char subject[2] = { 0, 0 };
> c1 = c;
> if (case_fold)
> {
> c1 = tolower (c1);
> c2 = tolower (c2);
> }
>
> pattern[1] = c1;
> pattern[3] = c2;
> regcomp (&re, pattern, REG_NOSUB);
> for (c = 0; c < NOTCHAR; ++c)
> {
> if ((case_fold && isupper (c))
> || (MB_CUR_MAX > 1 && btowc (c) == WEOF))
> continue;
> subject[0] = c;
> if (regexec (&re, subject, 0, NULL, 0) != REG_NOMATCH)
> setbit_case_fold_c (c, ccl);
> }
> regfree (&re);
> #else
> c1 = c;
> if (case_fold)
> {
> c1 = tolower (c1);
> c2 = tolower (c2);
> }
> for (c = c1; c <= c2; c++)
> setbit_case_fold_c (c, ccl);
> #endif
>
> I would suggest distros to rip out the #else part of this #ifndef.
And I wouldn't, but as I have no control over the distros, I'm
not going to worry about it.
All I know is that with the non-gawk case, gawk fails its test suite,
and I've given up discussing it.
Arnold