t / helper / test-wildmatch.con commit Merge branch 'jk/test-helper-v-output-fix' (148bce9)
   1#include "cache.h"
   2
   3int cmd_main(int argc, const char **argv)
   4{
   5        int i;
   6        for (i = 2; i < argc; i++) {
   7                if (argv[i][0] == '/')
   8                        die("Forward slash is not allowed at the beginning of the\n"
   9                            "pattern because Windows does not like it. Use `XXX/' instead.");
  10                else if (!strncmp(argv[i], "XXX/", 4))
  11                        argv[i] += 3;
  12        }
  13        if (!strcmp(argv[1], "wildmatch"))
  14                return !!wildmatch(argv[3], argv[2], WM_PATHNAME);
  15        else if (!strcmp(argv[1], "iwildmatch"))
  16                return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD);
  17        else if (!strcmp(argv[1], "pathmatch"))
  18                return !!wildmatch(argv[3], argv[2], 0);
  19        else if (!strcmp(argv[1], "ipathmatch"))
  20                return !!wildmatch(argv[3], argv[2], WM_CASEFOLD);
  21        else
  22                return 1;
  23}