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