summaryrefslogtreecommitdiffstats
path: root/contrib/tcsh/glob.c
diff options
context:
space:
mode:
authormp <mp@FreeBSD.org>2004-07-11 02:17:56 +0000
committermp <mp@FreeBSD.org>2004-07-11 02:17:56 +0000
commitbbd1addf8f9452690ad13ce5b875ee4cc9633958 (patch)
tree730792f0cc19f3bb4fb663fe727589381f5901be /contrib/tcsh/glob.c
parentf2c2aa29b7d05c53575ab7ce4dc5870fd33a1310 (diff)
downloadFreeBSD-src-bbd1addf8f9452690ad13ce5b875ee4cc9633958.zip
FreeBSD-src-bbd1addf8f9452690ad13ce5b875ee4cc9633958.tar.gz
Import of tcsh-6.13.00
Diffstat (limited to 'contrib/tcsh/glob.c')
-rw-r--r--contrib/tcsh/glob.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/tcsh/glob.c b/contrib/tcsh/glob.c
index e8e5e13..8e107c9 100644
--- a/contrib/tcsh/glob.c
+++ b/contrib/tcsh/glob.c
@@ -146,8 +146,8 @@ static void qprintf __P((Char *));
#endif
int
-globcharcoll(c1, c2)
- int c1, c2;
+globcharcoll(c1, c2, cs)
+ int c1, c2, cs;
{
#if defined(NLS) && defined(LC_COLLATE) && !defined(NOSTRCOLL)
char s1[2], s2[2];
@@ -158,8 +158,13 @@ globcharcoll(c1, c2)
* From kevin lyda <kevin@suberic.net>:
* strcoll does not guarantee case sorting, so we pre-process now:
*/
- if (islower(c1) && isupper(c2))
- return (1);
+ if (cs) {
+ c1 = islower(c1) ? c1 : tolower(c1);
+ c2 = islower(c2) ? c2 : tolower(c2);
+ } else {
+ if (islower(c1) && isupper(c2))
+ return (1);
+ }
s1[0] = c1;
s2[0] = c2;
s1[1] = s2[1] = '\0';
@@ -701,8 +706,8 @@ match(name, pat, patend, m_not)
++pat;
while (((c = *pat++) & M_MASK) != M_END) {
if ((*pat & M_MASK) == M_RNG) {
- if (globcharcoll(CHAR(c), CHAR(k)) <= 0 &&
- globcharcoll(CHAR(k), CHAR(pat[1])) <= 0)
+ if (globcharcoll(CHAR(c), CHAR(k), 0) <= 0 &&
+ globcharcoll(CHAR(k), CHAR(pat[1]), 0) <= 0)
ok = 1;
pat += 2;
}
OpenPOWER on IntegriCloud