aboutsummaryrefslogtreecommitdiff
path: root/str.c
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2017-04-15 00:51:18 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2017-04-15 00:51:18 +0000
commit85813b0c12abc28e502c1b1ae68d71ccfbd89b86 (patch)
tree15fee7050cc8d838064875460fa4480606d2e0c9 /str.c
parent60a7ffecc77c5e3bf4aa5462ebf16bbd377a5af8 (diff)
Import bmake-20170413vendor/NetBSD/bmake/20170413
Notes
svn path=/vendor/NetBSD/bmake/dist/; revision=316947 svn path=/vendor/NetBSD/bmake/20170413/; revision=316948; tag=vendor/NetBSD/bmake/20170413
Diffstat (limited to 'str.c')
-rw-r--r--str.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/str.c b/str.c
index 5e4e8f6cc1c9..4c56e15b78df 100644
--- a/str.c
+++ b/str.c
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.36 2016/04/06 09:57:00 gson Exp $ */
+/* $NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.36 2016/04/06 09:57:00 gson Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90";
#else
-__RCSID("$NetBSD: str.c,v 1.36 2016/04/06 09:57:00 gson Exp $");
+__RCSID("$NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -373,16 +373,23 @@ Str_Match(const char *string, const char *pattern)
* by a range (two characters separated by "-").
*/
if (*pattern == '[') {
+ int nomatch;
+
++pattern;
+ if (*pattern == '^') {
+ ++pattern;
+ nomatch = 1;
+ } else
+ nomatch = 0;
for (;;) {
if ((*pattern == ']') || (*pattern == 0))
- return(0);
+ return(nomatch);
if (*pattern == *string)
break;
if (pattern[1] == '-') {
c2 = pattern[2];
if (c2 == 0)
- return(0);
+ return(nomatch);
if ((*pattern <= *string) &&
(c2 >= *string))
break;
@@ -393,6 +400,8 @@ Str_Match(const char *string, const char *pattern)
}
++pattern;
}
+ if (nomatch)
+ return 0;
while ((*pattern != ']') && (*pattern != 0))
++pattern;
goto thisCharOK;