Revision c8db708d5d865a2085230687689868520863abe1 authored by René Scharfe on 30 September 2014, 17:42:03 UTC, committed by Junio C Hamano on 30 September 2014, 18:53:23 UTC
FreeBSD's printf(1) doesn't accept empty strings for numerical format
specifiers:

	$ printf "%d\n" "" >/dev/null; echo $?
	printf: : expected numeric value
	1

Initialize the AWK variable c to make sure the shell variable
subtree_count always contains a numerical value, in order to keep the
subsequently called printf happy.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 4ed115e
Raw File
test-wildmatch.c
#include "cache.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], WM_PATHNAME, NULL);
	else if (!strcmp(argv[1], "iwildmatch"))
		return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD, NULL);
	else if (!strcmp(argv[1], "pathmatch"))
		return !!wildmatch(argv[3], argv[2], 0, NULL);
	else
		return 1;
}
back to top