X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpatmatch.h;h=177126199515d69a8f960c2dc5e72776ab0a8c5f;hb=997624f88f37bec5cb96cf9fc3b3cac05ccc6ed8;hp=6d51216ba8d8dd0820f0809912edf794eb7b4df5;hpb=fab01e0b82bb1678b168fe56940aaa555c3360d5;p=libucw.git diff --git a/lib/patmatch.h b/lib/patmatch.h index 6d51216b..17712619 100644 --- a/lib/patmatch.h +++ b/lib/patmatch.h @@ -1,7 +1,10 @@ /* * Sherlock Library -- Generic Shell-Like Pattern Matching (currently only '?' and '*') * - * (c) 1997 Martin Mares, + * (c) 1997 Martin Mares + * + * 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 {