From 2431da5c7e95582f9b4ddf9fcfbc23641ad92829 Mon Sep 17 00:00:00 2001 From: Juli Mallett Date: Thu, 20 Jun 2002 19:41:21 +0000 Subject: [PATCH] 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(-) diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index 1431687d5a9b..38754e1f4b00 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; } /*-