From cf5af427a082850ef5fbcbf7a6e17ec484abf2fe Mon Sep 17 00:00:00 2001 From: jmallett Date: Thu, 20 Jun 2002 19:41:21 +0000 Subject: Look for wildcards, and balanced meta-characters such as { and } like NetBSD does. Obtained from: NetBSD --- usr.bin/make/dir.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'usr.bin/make') diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index 1431687..38754e1 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -296,17 +296,33 @@ Dir_HasWildcards (name) char *name; /* name to check */ { char *cp; + int wild = 0, brace = 0, bracket = 0; for (cp = name; *cp; cp++) { switch(*cp) { case '{': + brace++; + wild = 1; + break; + case '}': + brace--; + break; case '[': + bracket++; + wild = 1; + break; + case ']': + bracket--; + break; case '?': case '*': - return (TRUE); + wild = 1; + break; + default: + break; } } - return (FALSE); + return wild && bracket == 0 && brace == 0; } /*- -- cgit v1.1