On Tue, Mar 27, 2001 at 12:22:03PM -0600, Jarkko Hietaniemi wrote:
> On Tue, Mar 27, 2001 at 12:42:35PM -0500, Benjamin Sugars wrote:
> > On Tue, 27 Mar 2001, Jarkko Hietaniemi wrote:
> > 
> > > Hmm.  In bleadperl (which has Sarathy's alphasort patch) and Tru64:
> > > 
> > > # f_ascii = A.test B.test C.test a.test b.test c.test
> > > # g_ascii = A.test B.test C.test a.test b.test c.test
> > > ok 10
> > > # f_alpha = A.test a.test B.test b.test C.test c.test
> > > # g_alpha = A.test a.test b.test B.test C.test c.test
> > > not ok 11
> > > 
> > > Not a locale thing, LC_ALL=C doesn't change the result.
> > 
> > What about LANG?
> 
> Unset.

I think the following patch, or its moral equivalent, is needed.
Saying 'case-insensitive' isn't enough: you need to tell what to
do if the keys compare equal (in other words, we need two-level
comparison).  This patch makes the test pass in Tru64.

==== //depot/perl/ext/File/Glob/bsd_glob.c#8 - 
/u/vieraat/vieraat/jhi/pp4/perl/ext/File/Glob/bsd_glob.c ====
Index: perl/ext/File/Glob/bsd_glob.c
--- perl/ext/File/Glob/bsd_glob.c.~1~   Tue Mar 27 21:57:18 2001
+++ perl/ext/File/Glob/bsd_glob.c       Tue Mar 27 21:57:18 2001
@@ -545,13 +545,17 @@
 {
     const char *pp = *(const char **)p;
     const char *qq = *(const char **)q;
+    int ci;
     while (*pp && *qq) {
        if (tolower(*pp) != tolower(*qq))
            break;
        ++pp;
        ++qq;
     }
-    return (tolower(*pp) - tolower(*qq));
+    ci = tolower(*pp) - tolower(*qq);
+    if (ci == 0)
+       return compare(p, q);
+    return ci;
 }
 
 static int
End of Patch.


-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Reply via email to