*** glob.c.orig Sat Nov 13 03:40:56 1993 --- glob.c Mon Dec 16 03:09:07 1996 *************** *** 139,144 **** --- 139,165 ---- #define M_SET META('[') #define ismeta(c) (((c)&M_META) != 0) + int collate_range_cmp (c1, c2) + int c1, c2; + { + #if defined(NLS) && defined(LC_COLLATE) + static char s1[2], s2[2]; + int ret; + #endif + + c1 &= 0xFF; + c2 &= 0xFF; + #if defined(NLS) && defined(LC_COLLATE) + if (c1 == c2) + return (0); + s1[0] = c1; + s2[0] = c2; + if ((ret = strcoll(s1, s2)) != 0) + return (ret); + #endif + return (c1 - c2); + } + /* * Need to dodge two kernel bugs: * opendir("") != opendir(".") *************** *** 646,652 **** ++pat; while (((c = *pat++) & M_MASK) != M_END) { if ((*pat & M_MASK) == M_RNG) { ! if (c <= k && k <= pat[1]) ok = 1; pat += 2; } --- 667,675 ---- ++pat; while (((c = *pat++) & M_MASK) != M_END) { if ((*pat & M_MASK) == M_RNG) { ! if ( collate_range_cmp(CHAR(c), CHAR(k)) <= 0 ! && collate_range_cmp(CHAR(k), CHAR(pat[1])) <= 0 ! ) ok = 1; pat += 2; } *** sh.glob.c.orig Sun May 14 00:49:17 1995 --- sh.glob.c Thu Oct 31 18:04:28 1996 *************** *** 85,90 **** --- 85,91 ---- static void pword __P((int)); static void psave __P((int)); static void backeval __P((Char *, bool)); + extern int collate_range_cmp __P((int, int)); static Char * globtilde(nv, s) *************** *** 1038,1045 **** if (match) continue; if (rangec == '-' && *(pattern-2) != '[' && *pattern != ']') { ! match = (stringc <= (*pattern & TRIM) && ! (*(pattern-2) & TRIM) <= stringc); pattern++; } else --- 1039,1047 ---- if (match) continue; if (rangec == '-' && *(pattern-2) != '[' && *pattern != ']') { ! match = ( collate_range_cmp(stringc, *pattern & TRIM) <= 0 ! && collate_range_cmp(*(pattern-2) & TRIM, stringc) <= 0 ! ); pattern++; } else