]> mj.ucw.cz Git - libucw.git/blobdiff - lib/patmatch.c
Added bit_array_assign(), replaced BIT_ARRAY_ALLOC by functions.
[libucw.git] / lib / patmatch.c
index 32e3df1dbcaf7be527f6efcea6b0295a4af68ec1..bfd8aa50e7dc3e1ab712ab3efa7c4cc00bd08715 100644 (file)
@@ -1,37 +1,15 @@
 /*
- *     Sherlock Library -- Shell-Like Pattern Matching (currently only '?' and '*')
+ *     UCW Library -- 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.
  */
 
-#include <stdio.h>
-#include <string.h>
-
-#include "lib.h"
+#include "lib/lib.h"
 
-int
-match_pattern(byte *p, byte *s)
-{
-  while (*p)
-    {
-      if (*p == '?' && *s)
-       p++, s++;
-      else if (*p == '*')
-       {
-         int z = p[1];
+#define Convert(x) (x)
+#define MATCH_FUNC_NAME match_pattern
 
-         if (!z)
-           return 1;
-         while (s = strchr(s, z))
-           {
-             if (match_pattern(p+1, s))
-               return 1;
-             s++;
-           }
-         return 0;
-       }
-      else if (*p++ != *s++)
-       return 0;
-    }
-  return !*s;
-}
+#include "lib/patmatch.h"