1ed299
diff --git a/match.c b/match.c
1ed299
index 6cd656f..4e569f5 100644
1ed299
--- a/match.c
1ed299
+++ b/match.c
1ed299
@@ -190,10 +190,10 @@ char *___tmp_ptr;
1ed299
 
1ed299
 #endif
1ed299
 
1ed299
-static int recmatch(p, s, cs)
1ed299
+static int recmatch(p, s, ci)
1ed299
 ZCONST char *p;         /* sh pattern to match */
1ed299
 ZCONST char *s;         /* string to match it to */
1ed299
-int cs;                 /* flag: force case-sensitive matching */
1ed299
+int ci;                 /* flag: force case-insensitive matching */
1ed299
 /* Recursively compare the sh pattern p with the string s and return 1 if
1ed299
    they match, and 0 or 2 if they don't or if there is a syntax error in the
1ed299
    pattern.  This routine recurses on itself no deeper than the number of
1ed299
@@ -214,7 +214,7 @@ int cs;                 /* flag: force case-sensitive matching */
1ed299
   if (CLEN(p) == 2) {
1ed299
     if (CLEN(s) == 2) {
1ed299
       return (*p == *s && *(p+1) == *(s+1)) ?
1ed299
-        recmatch(p + 2, s + 2, cs) : 0;
1ed299
+        recmatch(p + 2, s + 2, ci) : 0;
1ed299
     } else {
1ed299
       return 0;
1ed299
     }
1ed299
@@ -230,9 +230,9 @@ int cs;                 /* flag: force case-sensitive matching */
1ed299
   /* '?' (or '%' or '#') matches any character (but not an empty string) */
1ed299
   if (c == WILDCHR_SINGLE) {
1ed299
     if (wild_stop_at_dir)
1ed299
-      return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), cs) : 0;
1ed299
+      return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), ci) : 0;
1ed299
     else
1ed299
-      return *s ? recmatch(p, s + CLEN(s), cs) : 0;
1ed299
+      return *s ? recmatch(p, s + CLEN(s), ci) : 0;
1ed299
   }
1ed299
 
1ed299
   /* WILDCHR_MULTI ('*') matches any number of characters, including zero */
1ed299
@@ -253,14 +253,14 @@ int cs;                 /* flag: force case-sensitive matching */
1ed299
 # endif /* ?AMIGA */
1ed299
         /* Single WILDCHR_MULTI ('*'): this doesn't match slashes */
1ed299
         for (; *s && *s != DIRSEP_CHR; INCSTR(s))
1ed299
-          if ((c = recmatch(p, s, cs)) != 0)
1ed299
+          if ((c = recmatch(p, s, ci)) != 0)
1ed299
             return c;
1ed299
         /* end of pattern: matched if at end of string, else continue */
1ed299
         if (*p == 0)
1ed299
           return (*s == 0);
1ed299
         /* continue to match if at DIRSEP_CHR in pattern, else give up */
1ed299
         return (*p == DIRSEP_CHR || (*p == '\\' && p[1] == DIRSEP_CHR))
1ed299
-               ? recmatch(p, s, cs) : 2;
1ed299
+               ? recmatch(p, s, ci) : 2;
1ed299
       }
1ed299
       /* Two consecutive WILDCHR_MULTI ("**"): this matches DIRSEP_CHR ('/') */
1ed299
       p++;        /* move p past the second WILDCHR_MULTI */
1ed299
@@ -308,17 +308,17 @@ int cs;                 /* flag: force case-sensitive matching */
1ed299
          */
1ed299
         if (q != srest)
1ed299
           return 0;
1ed299
-        return ((cs ? strcmp(p, q) : namecmp(p, q)) == 0);
1ed299
+        return ((!ci ? strcmp(p, q) : namecmp(p, q)) == 0);
1ed299
       }
1ed299
 #else /* !_MBCS */
1ed299
-        return ((cs ? strcmp(p, srest) : namecmp(p, srest)) == 0);
1ed299
+        return ((!ci ? strcmp(p, srest) : namecmp(p, srest)) == 0);
1ed299
 #endif /* ?_MBCS */
1ed299
     }
1ed299
     else
1ed299
     {
1ed299
       /* pattern contains more wildcards, continue with recursion... */
1ed299
       for (; *s; INCSTR(s))
1ed299
-        if ((c = recmatch(p, s, cs)) != 0)
1ed299
+        if ((c = recmatch(p, s, ci)) != 0)
1ed299
           return c;
1ed299
       return 2;           /* 2 means give up--shmatch will return false */
1ed299
     }
1ed299
@@ -353,17 +353,17 @@ int cs;                 /* flag: force case-sensitive matching */
1ed299
         c = *(p-1);
1ed299
       else
1ed299
       {
1ed299
-        uch cc = (cs ? (uch)*s : case_map((uch)*s));
1ed299
+        uch cc = (!ci ? (uch)*s : to_up((uch)*s));
1ed299
         uch uc = (uch) c;
1ed299
         if (*(p+1) != '-')
1ed299
           for (uc = uc ? uc : (uch)*p; uc <= (uch)*p; uc++)
1ed299
             /* compare range */
1ed299
-            if ((cs ? uc : case_map(uc)) == cc)
1ed299
-              return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), cs);
1ed299
+            if ((!ci ? uc : to_up(uc)) == cc)
1ed299
+              return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), ci);
1ed299
         c = e = 0;                      /* clear range, escape flags */
1ed299
       }
1ed299
     }
1ed299
-    return r ? recmatch(q + CLEN(q), s + CLEN(s), cs) : 0;
1ed299
+    return r ? recmatch(q + CLEN(q), s + CLEN(s), ci) : 0;
1ed299
                                         /* bracket match failed */
1ed299
   }
1ed299
 #endif /* !VMS */
1ed299
@@ -382,18 +382,18 @@ int cs;                 /* flag: force case-sensitive matching */
1ed299
   {
1ed299
     /* Match "...]" with "]".  Continue after "]" in both. */
1ed299
     if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
1ed299
-      return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
1ed299
+      return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), ci);
1ed299
 
1ed299
     /* Else, look for a reduced match in s, until "]" in or end of s. */
1ed299
     for (; *s && (*s != ']'); INCSTR(s))
1ed299
       if (*s == '.')
1ed299
         /* If reduced match, then continue after "..." in p, "." in s. */
1ed299
-        if ((c = recmatch( (p+ CLEN( p)), s, cs)) != 0)
1ed299
+        if ((c = recmatch( (p+ CLEN( p)), s, ci)) != 0)
1ed299
           return (int)c;
1ed299
 
1ed299
     /* Match "...]" with "]".  Continue after "]" in both. */
1ed299
     if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
1ed299
-      return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
1ed299
+      return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), ci);
1ed299
 
1ed299
     /* No reduced match.  Quit. */
1ed299
     return 2;
1ed299
@@ -402,8 +402,8 @@ int cs;                 /* flag: force case-sensitive matching */
1ed299
 #endif /* def VMS */
1ed299
 
1ed299
   /* Just a character--compare it */
1ed299
-  return (cs ? c == *s : case_map((uch)c) == case_map((uch)*s)) ?
1ed299
-          recmatch(p, s + CLEN(s), cs) : 0;
1ed299
+  return (!ci ? c == *s : to_up((uch)c) == to_up((uch)*s)) ?
1ed299
+          recmatch(p, s + CLEN(s), ci) : 0;
1ed299
 }
1ed299
 
1ed299