diff options
Diffstat (limited to 'str.c')
-rw-r--r-- | str.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $ */ +/* $NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $"; +static char rcsid[] = "$NetBSD: str.c,v 1.38 2017/04/21 22:15:44 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.37 2017/04/11 17:30:13 sjg Exp $"); +__RCSID("$NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -382,8 +382,11 @@ Str_Match(const char *string, const char *pattern) } else nomatch = 0; for (;;) { - if ((*pattern == ']') || (*pattern == 0)) - return(nomatch); + if ((*pattern == ']') || (*pattern == 0)) { + if (nomatch) + break; + return(0); + } if (*pattern == *string) break; if (pattern[1] == '-') { @@ -400,7 +403,7 @@ Str_Match(const char *string, const char *pattern) } ++pattern; } - if (nomatch) + if (nomatch && (*pattern != ']') && (*pattern != 0)) return 0; while ((*pattern != ']') && (*pattern != 0)) ++pattern; |