summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-06-20 19:41:21 +0000
committerjmallett <jmallett@FreeBSD.org>2002-06-20 19:41:21 +0000
commitcf5af427a082850ef5fbcbf7a6e17ec484abf2fe (patch)
tree8835447994f21a35f8884e5851b680e09d838bf0 /usr.bin/make
parentf59ce1b70d386ec5b8b802a7e130a346a5421388 (diff)
downloadFreeBSD-src-cf5af427a082850ef5fbcbf7a6e17ec484abf2fe.zip
FreeBSD-src-cf5af427a082850ef5fbcbf7a6e17ec484abf2fe.tar.gz
Look for wildcards, and balanced meta-characters such as { and } like NetBSD
does. Obtained from: NetBSD
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/dir.c20
1 files changed, 18 insertions, 2 deletions
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;
}
/*-
OpenPOWER on IntegriCloud