1564bd57b3c4c43c5420c045ef523b89a08742cc
   1#ifdef USE_WILDMATCH
   2#undef USE_WILDMATCH  /* We need real fnmatch implementation here */
   3#endif
   4#include "cache.h"
   5#include "wildmatch.h"
   6
   7int main(int argc, char **argv)
   8{
   9        int i;
  10        for (i = 2; i < argc; i++) {
  11                if (argv[i][0] == '/')
  12                        die("Forward slash is not allowed at the beginning of the\n"
  13                            "pattern because Windows does not like it. Use `XXX/' instead.");
  14                else if (!strncmp(argv[i], "XXX/", 4))
  15                        argv[i] += 3;
  16        }
  17        if (!strcmp(argv[1], "wildmatch"))
  18                return !!wildmatch(argv[3], argv[2], WM_PATHNAME, NULL);
  19        else if (!strcmp(argv[1], "iwildmatch"))
  20                return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD, NULL);
  21        else if (!strcmp(argv[1], "pathmatch"))
  22                return !!wildmatch(argv[3], argv[2], 0, NULL);
  23        else if (!strcmp(argv[1], "fnmatch"))
  24                return !!fnmatch(argv[3], argv[2], FNM_PATHNAME);
  25        else
  26                return 1;
  27}