02d1f3
diff -up unzip60/match.c.recmatch unzip60/match.c
02d1f3
--- unzip60/match.c.recmatch	2005-08-14 13:00:36.000000000 -0400
02d1f3
+++ unzip60/match.c	2013-05-28 10:29:57.949077543 -0400
02d1f3
@@ -27,16 +27,14 @@
02d1f3
 
02d1f3
   ---------------------------------------------------------------------------
02d1f3
 
02d1f3
-  Copyright on recmatch() from Zip's util.c (although recmatch() was almost
02d1f3
-  certainly written by Mark Adler...ask me how I can tell :-) ):
02d1f3
+  Copyright on recmatch() from Zip's util.c
02d1f3
+	 Copyright (c) 1990-2005 Info-ZIP.  All rights reserved.
02d1f3
 
02d1f3
-     Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
02d1f3
-     Kai Uwe Rommel and Igor Mandrichenko.
02d1f3
+	 See the accompanying file LICENSE, version 2004-May-22 or later
02d1f3
+	 for terms of use.
02d1f3
+	 If, for some reason, both of these files are missing, the Info-ZIP license
02d1f3
+	 also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html  
02d1f3
 
02d1f3
-     Permission is granted to any individual or institution to use, copy,
02d1f3
-     or redistribute this software so long as all of the original files are
02d1f3
-     included unmodified, that it is not sold for profit, and that this copy-
02d1f3
-     right notice is retained.
02d1f3
 
02d1f3
   ---------------------------------------------------------------------------
02d1f3
 
02d1f3
@@ -53,7 +51,7 @@
02d1f3
 
02d1f3
   A set is composed of characters or ranges; a range looks like ``character
02d1f3
   hyphen character'' (as in 0-9 or A-Z).  [0-9a-zA-Z_] is the minimal set of
02d1f3
-  characters allowed in the [..] pattern construct.  Other characters are
02d1f3
+  characters ALlowed in the [..] pattern construct.  Other characters are
02d1f3
   allowed (i.e., 8-bit characters) if your system will support them.
02d1f3
 
02d1f3
   To suppress the special syntactic significance of any of ``[]*?!^-\'', in-
02d1f3
@@ -101,8 +99,32 @@
02d1f3
 #  define WILDCHAR   '?'
02d1f3
 #  define BEG_RANGE  '['
02d1f3
 #  define END_RANGE  ']'
02d1f3
+#  define WILDCHR_SINGLE '?'
02d1f3
+#  define DIRSEP_CHR '/'
02d1f3
+#  define WILDCHR_MULTI '*'
02d1f3
 #endif
02d1f3
 
02d1f3
+#ifdef WILD_STOP_AT_DIR
02d1f3
+   int wild_stop_at_dir = 1; /* default wildcards do not include / in matches */
02d1f3
+#else
02d1f3
+   int wild_stop_at_dir = 0; /* default wildcards do include / in matches */
02d1f3
+#endif
02d1f3
+
02d1f3
+
02d1f3
+
02d1f3
+/*
02d1f3
+ * case mapping functions. case_map is used to ignore case in comparisons,
02d1f3
+ * to_up is used to force upper case even on Unix (for dosify option).
02d1f3
+ */
02d1f3
+#ifdef USE_CASE_MAP
02d1f3
+#  define case_map(c) upper[(c) & 0xff]
02d1f3
+#  define to_up(c)    upper[(c) & 0xff]
02d1f3
+#else
02d1f3
+#  define case_map(c) (c)
02d1f3
+#  define to_up(c)    ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c))
02d1f3
+#endif /* USE_CASE_MAP */
02d1f3
+
02d1f3
+
02d1f3
 #if 0                /* GRR:  add this to unzip.h someday... */
02d1f3
 #if !(defined(MSDOS) && defined(DOSWILD))
02d1f3
 #ifdef WILD_STOP_AT_DIR
02d1f3
@@ -114,8 +136,8 @@ int recmatch OF((ZCONST uch *pattern, ZC
02d1f3
                  int ignore_case __WDLPRO));
02d1f3
 #endif
02d1f3
 #endif /* 0 */
02d1f3
-static int recmatch OF((ZCONST uch *pattern, ZCONST uch *string,
02d1f3
-                        int ignore_case __WDLPRO));
02d1f3
+static int recmatch OF((ZCONST char *, ZCONST char *, 
02d1f3
+                        int));
02d1f3
 static char *isshexp OF((ZCONST char *p));
02d1f3
 static int namecmp OF((ZCONST char *s1, ZCONST char *s2));
02d1f3
 
02d1f3
@@ -154,192 +176,240 @@ int match(string, pattern, ignore_case _
02d1f3
             }
02d1f3
             dospattern[j-1] = '\0';                    /* nuke the end "." */
02d1f3
         }
02d1f3
-        j = recmatch((uch *)dospattern, (uch *)string, ignore_case __WDL);
02d1f3
+        j = recmatch(dospattern, string, ignore_case);
02d1f3
         free(dospattern);
02d1f3
         return j == 1;
02d1f3
     } else
02d1f3
 #endif /* MSDOS && DOSWILD */
02d1f3
-    return recmatch((uch *)pattern, (uch *)string, ignore_case __WDL) == 1;
02d1f3
+    return recmatch(pattern, string, ignore_case) == 1;
02d1f3
 }
02d1f3
 
02d1f3
+#ifdef _MBCS
02d1f3
+
02d1f3
+char *___tmp_ptr;
02d1f3
 
02d1f3
+#endif
02d1f3
 
02d1f3
-static int recmatch(p, s, ic __WDL)
02d1f3
-    ZCONST uch *p;        /* sh pattern to match */
02d1f3
-    ZCONST uch *s;        /* string to which to match it */
02d1f3
-    int ic;               /* true for case insensitivity */
02d1f3
-    __WDLDEF              /* directory sepchar for WildStopAtDir mode, or 0 */
02d1f3
+static int recmatch(p, s, cs)
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
 /* 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 more deeply than the number
02d1f3
- * of characters in the pattern. */
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
+   characters in the pattern. */
02d1f3
 {
02d1f3
-    unsigned int c;       /* pattern char or start of range in [-] loop */
02d1f3
+  int c;                /* pattern char or start of range in [-] loop */
02d1f3
+  /* Get first character, the pattern for new recmatch calls follows */
02d1f3
+ /* borrowed from Zip's global.c */
02d1f3
+ int no_wild = 0; 
02d1f3
+ int allow_regex=1;
02d1f3
+  /* This fix provided by akt@m5.dion.ne.jp for Japanese.
02d1f3
+     See 21 July 2006 mail.
02d1f3
+     It only applies when p is pointing to a doublebyte character and
02d1f3
+     things like / and wildcards are not doublebyte.  This probably
02d1f3
+     should not be needed. */
02d1f3
 
02d1f3
-    /* Get first character, the pattern for new recmatch calls follows */
02d1f3
-    c = *p; INCSTR(p);
02d1f3
+#ifdef _MBCS
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
+    } else {
02d1f3
+      return 0;
02d1f3
+    }
02d1f3
+  }
02d1f3
+#endif /* ?_MBCS */
02d1f3
 
02d1f3
-    /* If that was the end of the pattern, match if string empty too */
02d1f3
-    if (c == 0)
02d1f3
-        return *s == 0;
02d1f3
+  c = *POSTINCSTR(p);
02d1f3
 
02d1f3
-    /* '?' (or '%') matches any character (but not an empty string). */
02d1f3
-    if (c == WILDCHAR)
02d1f3
-#ifdef WILD_STOP_AT_DIR
02d1f3
-        /* If uO.W_flag is non-zero, it won't match '/' */
02d1f3
-        return (*s && (!sepc || *s != (uch)sepc))
02d1f3
-               ? recmatch(p, s + CLEN(s), ic, sepc) : 0;
02d1f3
-#else
02d1f3
-        return *s ? recmatch(p, s + CLEN(s), ic) : 0;
02d1f3
-#endif
02d1f3
+  /* If that was the end of the pattern, match if string empty too */
02d1f3
+  if (c == 0)
02d1f3
+    return *s == 0;
02d1f3
+
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
+    else
02d1f3
+      return *s ? recmatch(p, s + CLEN(s), cs) : 0;
02d1f3
+  }
02d1f3
 
02d1f3
-    /* '*' matches any number of characters, including zero */
02d1f3
+  /* WILDCHR_MULTI ('*') matches any number of characters, including zero */
02d1f3
 #ifdef AMIGA
02d1f3
-    if (c == '#' && *p == '?')     /* "#?" is Amiga-ese for "*" */
02d1f3
-        c = '*', p++;
02d1f3
+  if (!no_wild && c == '#' && *p == '?')            /* "#?" is Amiga-ese for "*" */
02d1f3
+    c = WILDCHR_MULTI, p++;
02d1f3
 #endif /* AMIGA */
02d1f3
-    if (c == '*') {
02d1f3
-#ifdef WILD_STOP_AT_DIR
02d1f3
-        if (sepc) {
02d1f3
-          /* check for single "*" or double "**" */
02d1f3
-#  ifdef AMIGA
02d1f3
-          if ((c = p[0]) == '#' && p[1] == '?') /* "#?" is Amiga-ese for "*" */
02d1f3
-            c = '*', p++;
02d1f3
-          if (c != '*') {
02d1f3
-#  else /* !AMIGA */
02d1f3
-          if (*p != '*') {
02d1f3
-#  endif /* ?AMIGA */
02d1f3
-            /* single "*": this doesn't match the dirsep character */
02d1f3
-            for (; *s && *s != (uch)sepc; INCSTR(s))
02d1f3
-                if ((c = recmatch(p, s, ic, sepc)) != 0)
02d1f3
-                    return (int)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 sepc in pattern, else give up */
02d1f3
-            return (*p == (uch)sepc || (*p == '\\' && p[1] == (uch)sepc))
02d1f3
-                   ? recmatch(p, s, ic, sepc) : 2;
02d1f3
-          }
02d1f3
-          /* "**": this matches slashes */
02d1f3
-          ++p;        /* move p behind the second '*' */
02d1f3
-          /* and continue with the non-W_flag code variant */
02d1f3
-        }
02d1f3
-#endif /* WILD_STOP_AT_DIR */
02d1f3
+  if (!no_wild && c == WILDCHR_MULTI)
02d1f3
+  {
02d1f3
+    if (wild_stop_at_dir) {
02d1f3
+      /* Check for an immediately following WILDCHR_MULTI */
02d1f3
+# ifdef AMIGA
02d1f3
+      if ((c = p[0]) == '#' && p[1] == '?') /* "#?" is Amiga-ese for "*" */
02d1f3
+        c = WILDCHR_MULTI, p++;
02d1f3
+      if (c != WILDCHR_MULTI) {
02d1f3
+# else /* !AMIGA */
02d1f3
+      if (*p != WILDCHR_MULTI) {
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
+            return c;
02d1f3
+        /* end of pattern: matched if at end of string, else continue */
02d1f3
         if (*p == 0)
02d1f3
-            return 1;
02d1f3
-        if (isshexp((ZCONST char *)p) == NULL) {
02d1f3
-            /* Optimization for rest of pattern being a literal string:
02d1f3
-             * If there are no other shell expression chars in the rest
02d1f3
-             * of the pattern behind the multi-char wildcard, then just
02d1f3
-             * compare the literal string tail.
02d1f3
-             */
02d1f3
-            ZCONST uch *srest;
02d1f3
-
02d1f3
-            srest = s + (strlen((ZCONST char *)s) - strlen((ZCONST char *)p));
02d1f3
-            if (srest - s < 0)
02d1f3
-                /* remaining literal string from pattern is longer than rest
02d1f3
-                 * of test string, there can't be a match
02d1f3
-                 */
02d1f3
-                return 0;
02d1f3
-            else
02d1f3
-              /* compare the remaining literal pattern string with the last
02d1f3
-               * bytes of the test string to check for a match
02d1f3
-               */
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
+      }
02d1f3
+      /* Two consecutive WILDCHR_MULTI ("**"): this matches DIRSEP_CHR ('/') */
02d1f3
+      p++;        /* move p past the second WILDCHR_MULTI */
02d1f3
+      /* continue with the normal non-WILD_STOP_AT_DIR code */
02d1f3
+    } /* wild_stop_at_dir */
02d1f3
+
02d1f3
+    /* Not wild_stop_at_dir */
02d1f3
+    if (*p == 0)
02d1f3
+      return 1;
02d1f3
+    if (!isshexp((char *)p))
02d1f3
+    {
02d1f3
+      /* optimization for rest of pattern being a literal string */
02d1f3
+
02d1f3
+      /* optimization to handle patterns like *.txt */
02d1f3
+      /* if the first char in the pattern is '*' and there */
02d1f3
+      /* are no other shell expression chars, i.e. a literal string */
02d1f3
+      /* then just compare the literal string at the end */
02d1f3
+
02d1f3
+      ZCONST char *srest;
02d1f3
+
02d1f3
+      srest = s + (strlen(s) - strlen(p));
02d1f3
+      if (srest - s < 0)
02d1f3
+        /* remaining literal string from pattern is longer than rest of
02d1f3
+           test string, there can't be a match
02d1f3
+         */
02d1f3
+        return 0;
02d1f3
+      else
02d1f3
+        /* compare the remaining literal pattern string with the last bytes
02d1f3
+           of the test string to check for a match */
02d1f3
 #ifdef _MBCS
02d1f3
-            {
02d1f3
-                ZCONST uch *q = s;
02d1f3
+      {
02d1f3
+        ZCONST char *q = s;
02d1f3
 
02d1f3
-                /* MBCS-aware code must not scan backwards into a string from
02d1f3
-                 * the end.
02d1f3
-                 * So, we have to move forward by character from our well-known
02d1f3
-                 * character position s in the test string until we have
02d1f3
-                 * advanced to the srest position.
02d1f3
-                 */
02d1f3
-                while (q < srest)
02d1f3
-                  INCSTR(q);
02d1f3
-                /* In case the byte *srest is a trailing byte of a multibyte
02d1f3
-                 * character in the test string s, we have actually advanced
02d1f3
-                 * past the position (srest).
02d1f3
-                 * For this case, the match has failed!
02d1f3
-                 */
02d1f3
-                if (q != srest)
02d1f3
-                    return 0;
02d1f3
-                return ((ic
02d1f3
-                         ? namecmp((ZCONST char *)p, (ZCONST char *)q)
02d1f3
-                         : strcmp((ZCONST char *)p, (ZCONST char *)q)
02d1f3
-                        ) == 0);
02d1f3
-            }
02d1f3
+        /* MBCS-aware code must not scan backwards into a string from
02d1f3
+         * the end.
02d1f3
+         * So, we have to move forward by character from our well-known
02d1f3
+         * character position s in the test string until we have advanced
02d1f3
+         * to the srest position.
02d1f3
+         */
02d1f3
+        while (q < srest)
02d1f3
+          INCSTR(q);
02d1f3
+        /* In case the byte *srest is a trailing byte of a multibyte
02d1f3
+         * character, we have actually advanced past the position (srest).
02d1f3
+         * For this case, the match has failed!
02d1f3
+         */
02d1f3
+        if (q != srest)
02d1f3
+          return 0;
02d1f3
+        return ((cs ? strcmp(p, q) : namecmp(p, q)) == 0);
02d1f3
+      }
02d1f3
 #else /* !_MBCS */
02d1f3
-                return ((ic
02d1f3
-                         ? namecmp((ZCONST char *)p, (ZCONST char *)srest)
02d1f3
-                         : strcmp((ZCONST char *)p, (ZCONST char *)srest)
02d1f3
-                        ) == 0);
02d1f3
+        return ((cs ? strcmp(p, srest) : namecmp(p, srest)) == 0);
02d1f3
 #endif /* ?_MBCS */
02d1f3
-        } else {
02d1f3
-            /* pattern contains more wildcards, continue with recursion... */
02d1f3
-            for (; *s; INCSTR(s))
02d1f3
-                if ((c = recmatch(p, s, ic __WDL)) != 0)
02d1f3
-                    return (int)c;
02d1f3
-            return 2;  /* 2 means give up--match will return false */
02d1f3
-        }
02d1f3
     }
02d1f3
-
02d1f3
-    /* Parse and process the list of characters and ranges in brackets */
02d1f3
-    if (c == BEG_RANGE) {
02d1f3
-        int e;          /* flag true if next char to be taken literally */
02d1f3
-        ZCONST uch *q;  /* pointer to end of [-] group */
02d1f3
-        int r;          /* flag true to match anything but the range */
02d1f3
-
02d1f3
-        if (*s == 0)                            /* need a character to match */
02d1f3
-            return 0;
02d1f3
-        p += (r = (*p == '!' || *p == '^'));    /* see if reverse */
02d1f3
-        for (q = p, e = 0; *q; INCSTR(q))       /* find closing bracket */
02d1f3
-            if (e)
02d1f3
-                e = 0;
02d1f3
-            else
02d1f3
-                if (*q == '\\')      /* GRR:  change to ^ for MS-DOS, OS/2? */
02d1f3
-                    e = 1;
02d1f3
-                else if (*q == END_RANGE)
02d1f3
-                    break;
02d1f3
-        if (*q != END_RANGE)         /* nothing matches if bad syntax */
02d1f3
-            return 0;
02d1f3
-        for (c = 0, e = (*p == '-'); p < q; INCSTR(p)) {
02d1f3
-            /* go through the list */
02d1f3
-            if (!e && *p == '\\')               /* set escape flag if \ */
02d1f3
-                e = 1;
02d1f3
-            else if (!e && *p == '-')           /* set start of range if - */
02d1f3
-                c = *(p-1);
02d1f3
-            else {
02d1f3
-                unsigned int cc = Case(*s);
02d1f3
-
02d1f3
-                if (*(p+1) != '-')
02d1f3
-                    for (c = c ? c : *p; c <= *p; c++)  /* compare range */
02d1f3
-                        if ((unsigned)Case(c) == cc) /* typecast for MSC bug */
02d1f3
-                            return r ? 0 : recmatch(q + 1, s + 1, ic __WDL);
02d1f3
-                c = e = 0;   /* clear range, escape flags */
02d1f3
-            }
02d1f3
-        }
02d1f3
-        return r ? recmatch(q + CLEN(q), s + CLEN(s), ic __WDL) : 0;
02d1f3
-                                        /* bracket match failed */
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
+          return c;
02d1f3
+      return 2;           /* 2 means give up--shmatch will return false */
02d1f3
     }
02d1f3
+  }
02d1f3
 
02d1f3
-    /* if escape ('\\'), just compare next character */
02d1f3
-    if (c == '\\' && (c = *p++) == 0)     /* if \ at end, then syntax error */
02d1f3
-        return 0;
02d1f3
+#ifndef VMS             /* No bracket matching in VMS */
02d1f3
+  /* Parse and process the list of characters and ranges in brackets */
02d1f3
+  if (!no_wild && allow_regex && c == '[')
02d1f3
+  {
02d1f3
+    int e;              /* flag true if next char to be taken literally */
02d1f3
+    ZCONST char *q;     /* pointer to end of [-] group */
02d1f3
+    int r;              /* flag true to match anything but the range */
02d1f3
+
02d1f3
+    if (*s == 0)                        /* need a character to match */
02d1f3
+      return 0;
02d1f3
+    p += (r = (*p == '!' || *p == '^')); /* see if reverse */
02d1f3
+    for (q = p, e = 0; *q; q++)         /* find closing bracket */
02d1f3
+      if (e)
02d1f3
+        e = 0;
02d1f3
+      else
02d1f3
+        if (*q == '\\')
02d1f3
+          e = 1;
02d1f3
+        else if (*q == ']')
02d1f3
+          break;
02d1f3
+    if (*q != ']')                      /* nothing matches if bad syntax */
02d1f3
+      return 0;
02d1f3
+    for (c = 0, e = *p == '-'; p < q; p++)      /* go through the list */
02d1f3
+    {
02d1f3
+      if (e == 0 && *p == '\\')         /* set escape flag if \ */
02d1f3
+        e = 1;
02d1f3
+      else if (e == 0 && *p == '-')     /* set start of range if - */
02d1f3
+        c = *(p-1);
02d1f3
+      else
02d1f3
+      {
02d1f3
+        uch cc = (cs ? (uch)*s : case_map((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
+        c = e = 0;                      /* clear range, escape flags */
02d1f3
+      }
02d1f3
+    }
02d1f3
+    return r ? recmatch(q + CLEN(q), s + CLEN(s), cs) : 0;
02d1f3
+                                        /* bracket match failed */
02d1f3
+  }
02d1f3
+#endif /* !VMS */
02d1f3
 
02d1f3
-    /* just a character--compare it */
02d1f3
-#ifdef QDOS
02d1f3
-    return QMatch(Case((uch)c), Case(*s)) ?
02d1f3
-           recmatch(p, s + CLEN(s), ic __WDL) : 0;
02d1f3
-#else
02d1f3
-    return Case((uch)c) == Case(*s) ?
02d1f3
-           recmatch(p, s + CLEN(s), ic __WDL) : 0;
02d1f3
-#endif
02d1f3
+  /* If escape ('\'), just compare next character */
02d1f3
+  if (!no_wild && c == '\\')
02d1f3
+    if ((c = *p++) == '\0')             /* if \ at end, then syntax error */
02d1f3
+      return 0;
02d1f3
+
02d1f3
+#ifdef VMS
02d1f3
+  /* 2005-11-06 SMS.
02d1f3
+     Handle "..." wildcard in p with "." or "]" in s.
02d1f3
+  */
02d1f3
+  if ((c == '.') && (*p == '.') && (*(p+ CLEN( p)) == '.') &&
02d1f3
+   ((*s == '.') || (*s == ']')))
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
+
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
+          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
+
02d1f3
+    /* No reduced match.  Quit. */
02d1f3
+    return 2;
02d1f3
+  }
02d1f3
+
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
+}
02d1f3
 
02d1f3
-} /* end function recmatch() */
02d1f3
 
02d1f3
 
02d1f3
 
02d1f3
+/*************************************************************************************************/
02d1f3
 static char *isshexp(p)
02d1f3
 ZCONST char *p;
02d1f3
 /* If p is a sh expression, a pointer to the first special character is