1/*
2 * Copyright (c) 1989, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Guido van Rossum.
7 *
8 * Copyright (c) 2011 The FreeBSD Foundation
--- 25 unchanged lines hidden (view full) ---
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#if defined(LIBC_SCCS) && !defined(lint)
39static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94";
40#endif /* LIBC_SCCS and not lint */
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/lib/libc/gen/fnmatch.c 288309 2015-09-27 12:52:18Z jilles $");
43
44/*
45 * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
46 * Compares a filename or pathname to a pattern.
47 */
48
49/*
50 * Some notes on multibyte character support:
--- 240 unchanged lines hidden (view full) ---
291 if (c2 == EOS)
292 return (RANGE_ERROR);
293
294 if (flags & FNM_CASEFOLD)
295 c2 = towlower(c2);
296
297 if (table->__collate_load_error ?
298 c <= test && test <= c2 :
299 __collate_range_cmp(table, c, test) <= 0
300 && __collate_range_cmp(table, test, c2) <= 0
301 )
302 ok = 1;
303 } else if (c == test)
304 ok = 1;
305 }
306
307 *newp = (char *)pattern;
308 return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
309}
2 * Copyright (c) 1989, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Guido van Rossum.
7 *
8 * Copyright (c) 2011 The FreeBSD Foundation
--- 25 unchanged lines hidden (view full) ---
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#if defined(LIBC_SCCS) && !defined(lint)
39static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94";
40#endif /* LIBC_SCCS and not lint */
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/lib/libc/gen/fnmatch.c 288309 2015-09-27 12:52:18Z jilles $");
43
44/*
45 * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
46 * Compares a filename or pathname to a pattern.
47 */
48
49/*
50 * Some notes on multibyte character support:
--- 240 unchanged lines hidden (view full) ---
291 if (c2 == EOS)
292 return (RANGE_ERROR);
293
294 if (flags & FNM_CASEFOLD)
295 c2 = towlower(c2);
296
297 if (table->__collate_load_error ?
298 c <= test && test <= c2 :
299 __collate_range_cmp(table, c, test) <= 0
300 && __collate_range_cmp(table, test, c2) <= 0
301 )
302 ok = 1;
303 } else if (c == test)
304 ok = 1;
305 }
306
307 *newp = (char *)pattern;
308 return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
309}