Mercurial > hg > octave-kai > gnulib-hg
changeset 3459:616b1a72ff28
(fnmatch_no_wildcards): Fix confusion between
usage of FNM_CASEFOLD and FNM_LEADING_DIR. The bug was
spotted by Jim Meyering.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Mon, 03 Sep 2001 18:45:20 +0000 |
parents | 183a1d128ac3 |
children | 28c66612bada |
files | lib/exclude.c |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/exclude.c +++ b/lib/exclude.c @@ -118,20 +118,20 @@ static int fnmatch_no_wildcards (char const *pattern, char const *f, int options) { - if (! (options & FNM_CASEFOLD)) - return ((options & FNM_LEADING_DIR) + if (! (options & FNM_LEADING_DIR)) + return ((options & FNM_CASEFOLD) ? strcasecmp (pattern, f) : strcmp (pattern, f)); else { size_t patlen = strlen (pattern); - int r = ((options & FNM_LEADING_DIR) + int r = ((options & FNM_CASEFOLD) ? strncasecmp (pattern, f, patlen) : strncmp (pattern, f, patlen)); if (! r) { r = f[patlen]; - if (r == '/' && (options & FNM_LEADING_DIR)) + if (r == '/') r = 0; } return r;