git/test-wildmatch.c
Nguyễn Thái Ngọc Duy 3ae5396cf7 wildmatch: make wildmatch's return value compatible with fnmatch
wildmatch returns non-zero if matched, zero otherwise. This patch
makes it return zero if matches, non-zero otherwise, like fnmatch().

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-15 14:58:18 -07:00

15 lines
347 B
C

#include "cache.h"
#include "wildmatch.h"
int main(int argc, char **argv)
{
if (!strcmp(argv[1], "wildmatch"))
return !!wildmatch(argv[3], argv[2]);
else if (!strcmp(argv[1], "iwildmatch"))
return !!iwildmatch(argv[3], argv[2]);
else if (!strcmp(argv[1], "fnmatch"))
return !!fnmatch(argv[3], argv[2], FNM_PATHNAME);
else
return 1;
}