summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8a09872)
e.g. fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) incorrectly yielded zero.
-/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright 1991, 1992, 1993, 1996, 1997, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
for (c = *p++; c == '?' || c == '*'; c = *p++)
{
for (c = *p++; c == '?' || c == '*'; c = *p++)
{
- if ((flags & FNM_FILE_NAME) && *n == '/')
- /* A slash does not match a wildcard under FNM_FILE_NAME. */
- return FNM_NOMATCH;
- else if (c == '?')
{
/* A ? needs to match one character. */
{
/* A ? needs to match one character. */
+ if (*n == '\0' || (*n == '/' && (flags & FNM_FILE_NAME)))
/* There isn't another character; no match. */
return FNM_NOMATCH;
else
/* There isn't another character; no match. */
return FNM_NOMATCH;
else
+ {
+ if ((flags & (FNM_FILE_NAME | FNM_LEADING_DIR)) == FNM_FILE_NAME)
+ for (; *n != '\0'; n++)
+ if (*n == '/')
+ return FNM_NOMATCH;
+ return 0;
+ }
{
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
{
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
if ((c == '[' || FOLD (*n) == c1) &&
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
return 0;
if ((c == '[' || FOLD (*n) == c1) &&
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
return 0;
+ else if (*n == '/' && (flags & FNM_FILE_NAME))
+ break;