diff options
author | Roland McGrath <roland@gnu.org> | 1996-06-21 21:01:27 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-06-21 21:01:27 +0000 |
commit | 4f54cdb1dd4b8929231f42e22b79a0d5c7600cba (patch) | |
tree | 7780b1282b5f0849339424c2c94fc278f2dd8767 /posix | |
parent | 51fbd1f60a5c43fc5bde04952bc88b5545a83d13 (diff) | |
download | glibc-4f54cdb1dd4b8929231f42e22b79a0d5c7600cba.tar.gz glibc-4f54cdb1dd4b8929231f42e22b79a0d5c7600cba.tar.xz glibc-4f54cdb1dd4b8929231f42e22b79a0d5c7600cba.zip |
* sysdeps/sparc/elf/start.S: New file.
* sysdeps/sparc/dl-machine.h: New file. * posix/fnmatch.c (fnmatch): Fix \*[*?]+ case to increment name ptr only for ?s, not for *s. Fix from Chet Ramey. Fixes thanks to Raja R Harinath <harinath@cs.umn.edu>: * sysdeps/unix/sysv/utmpbits.h: Define _HAVE_UT_{TYPE,ID,TV,HOST}. Use __{BEGIN,END}_DECLS. (_PATH_WTMP, _PATH_UTMP, _PATH_LASTLOG): New macros. * login/utmp.h (UTMP_FILE, UTMP_FILENAME, WTMP_FILE, WTMP_FILENAME): New macros, moved here from sysdeps/gnu/utmpbits.h. * sysdeps/generic/utmpbits.h (_HAVE_UT_HOST): Define it. * sysdeps/gnu/utmpbits.h (_HAVE_UT_HOST): Likewise. * login/logout.c: Use ut_host only #if _HAVE_UT_HOST. Use sizeof instead of UT_*SIZE. * login/logwtmp.c: Likewise. * misc/tsearch.c (tdelete): Define as weak alias to __tdelete. * version.c (banner): Add trailing newline.
Diffstat (limited to 'posix')
-rw-r--r-- | posix/fnmatch.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/posix/fnmatch.c b/posix/fnmatch.c index 08c1c9448e..de45941f8f 100644 --- a/posix/fnmatch.c +++ b/posix/fnmatch.c @@ -92,10 +92,24 @@ fnmatch (pattern, string, flags) (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; - for (c = *p++; c == '?' || c == '*'; c = *p++, ++n) - if (((flags & FNM_FILE_NAME) && *n == '/') || - (c == '?' && *n == '\0')) - return FNM_NOMATCH; + 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. */ + if (*n == '\0') + /* There isn't another character; no match. */ + return FNM_NOMATCH; + else + /* One character of the string is consumed in matching + this ? wildcard, so *??? won't match if there are + less than three characters. */ + ++n; + } + } if (c == '\0') return 0; |