]> mj.ucw.cz Git - libucw.git/blobdiff - lib/patimatch.c
Initial version of SQL gathering utility gsql added.
[libucw.git] / lib / patimatch.c
index 8a0c8851f80b8798750092d31e8bff4c92cbbd7a..40a61756ad78b0034a2c54b836fd138f57ae91c5 100644 (file)
@@ -1,43 +1,13 @@
 /*
  *     Sherlock Library -- Shell-Like Case-Insensitive Pattern Matching (currently only '?' and '*')
  *
- *     (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1997 Martin Mares <mj@ucw.cz>
  */
 
-#include <stdio.h>
-#include <string.h>
+#include "lib/lib.h"
+#include "lib/chartype.h"
 
-#include "lib.h"
-#include "string.h"
+#define Convert(x) Cupcase(x)
+#define MATCH_FUNC_NAME match_pattern_nocase
 
-int
-match_pattern_nocase(byte *p, byte *s)
-{
-  while (*p)
-    {
-      if (*p == '?' && *s)
-       p++, s++;
-      else if (*p == '*')
-       {
-         int z = p[1];
-
-         if (!z)
-           return 1;
-         while (s = strchr(s, z))
-           {
-             if (match_pattern_nocase(p+1, s))
-               return 1;
-             s++;
-           }
-         return 0;
-       }
-      else
-       {
-         if (*p == '\\' && p[1])
-           p++;
-         if (Cupcase(*p++) != Cupcase(*s++))
-           return 0;
-       }
-    }
-  return !*s;
-}
+#include "lib/patmatch.h"