mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
![Nguyễn Thái Ngọc Duy](/assets/img/avatar_default.png)
- All exported constants now have a prefix WM_ - Do not rely on FNM_* constants, use the WM_ counterparts - Remove TRUE and FALSE to follow Git's coding style - While at it, turn flags type from int to unsigned int - Add an (unused yet) argument to carry extra information so that we don't have to change the prototype again later when we need to pass other stuff to wildmatch Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 lines
635 B
C
23 lines
635 B
C
#include "cache.h"
|
|
#include "wildmatch.h"
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int i;
|
|
for (i = 2; i < argc; i++) {
|
|
if (argv[i][0] == '/')
|
|
die("Forward slash is not allowed at the beginning of the\n"
|
|
"pattern because Windows does not like it. Use `XXX/' instead.");
|
|
else if (!strncmp(argv[i], "XXX/", 4))
|
|
argv[i] += 3;
|
|
}
|
|
if (!strcmp(argv[1], "wildmatch"))
|
|
return !!wildmatch(argv[3], argv[2], 0, NULL);
|
|
else if (!strcmp(argv[1], "iwildmatch"))
|
|
return !!wildmatch(argv[3], argv[2], WM_CASEFOLD, NULL);
|
|
else if (!strcmp(argv[1], "fnmatch"))
|
|
return !!fnmatch(argv[3], argv[2], FNM_PATHNAME);
|
|
else
|
|
return 1;
|
|
}
|