]> mj.ucw.cz Git - libucw.git/blobdiff - lib/patmatch.h
Merge with git+ssh://git.ucw.cz/projects/sherlock/GIT/sherlock.git
[libucw.git] / lib / patmatch.h
index 6d51216ba8d8dd0820f0809912edf794eb7b4df5..817c92daccd56b061fb3f894eb14e4f4c6bdafab 100644 (file)
@@ -1,7 +1,10 @@
 /*
- *     Sherlock Library -- Generic Shell-Like Pattern Matching (currently only '?' and '*')
+ *     UCW Library -- Generic Shell-Like Pattern Matching (currently only '?' and '*')
  *
- *     (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1997 Martin Mares <mj@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
  */
 
 int
@@ -20,15 +23,16 @@ MATCH_FUNC_NAME(byte *p, byte *s)
          if (z == '\\' && p[2])
            z = p[2];
          z = Convert(z);
-         while (*s)
+         for(;;)
            {
              while (*s && Convert(*s) != z)
                s++;
-             if (*s && match_pattern(p+1, s))
+             if (!*s)
+               return 0;
+             if (MATCH_FUNC_NAME(p+1, s))
                return 1;
              s++;
            }
-         return 0;
        }
       else
        {