/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002 Free Software Foundation, Inc.
+ 2002, 2003 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
# define __builtin_expect(expr, expected) (expr)
#endif
-#include <assert.h>
-#include <errno.h>
#include <fnmatch.h>
-#include <ctype.h>
-
-#if HAVE_STRING_H || defined _LIBC
-# include <string.h>
-#else
-# if HAVE_STRINGS_H
-# include <strings.h>
-# endif
-#endif
-#if defined STDC_HEADERS || defined _LIBC
-# include <stddef.h>
-# include <stdlib.h>
-#endif
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
#define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
/* Avoid depending on library functions or files
whose names are inconsistent. */
-# if !defined _LIBC && !defined getenv && !HAVE_DECL_GETENV
-extern char *getenv ();
-# endif
-
# ifndef errno
extern int errno;
# endif
int
-fnmatch (pattern, string, flags)
- const char *pattern;
- const char *string;
- int flags;
+fnmatch (const char *pattern, const char *string, int flags)
{
# if HANDLE_MULTIBYTE
if (__builtin_expect (MB_CUR_MAX, 1) != 1)
extern "C" {
# endif
-# if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
-# if !defined __GLIBC__ || !defined __P
-# undef __P
-# define __P(protos) protos
-# endif
-# else /* Not C++ or ANSI C. */
-# undef __P
-# define __P(protos) ()
-/* We can get away without defining `const' here only because in this file
- it is used only inside the prototype for `fnmatch', which is elided in
- non-ANSI C where `const' is problematical. */
-# endif /* C++ or ANSI C. */
-
/* We #undef these before defining them because some losing systems
(HP-UX A.08.07 for example) define these in <unistd.h>. */
# undef FNM_PATHNAME
/* Match NAME against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
-extern int fnmatch __P ((const char *__pattern, const char *__name,
- int __flags));
+extern int fnmatch (const char *__pattern, const char *__name,
+ int __flags);
# ifdef __cplusplus
}
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
-static int FCT (const CHAR *pattern, const CHAR *string,
- const CHAR *string_end, int no_leading_period, int flags)
- internal_function;
static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
const CHAR *string_end, int no_leading_period, int flags)
internal_function;
static int
internal_function
-FCT (pattern, string, string_end, no_leading_period, flags)
- const CHAR *pattern;
- const CHAR *string;
- const CHAR *string_end;
- int no_leading_period;
- int flags;
+FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
+ int no_leading_period, int flags)
{
register const CHAR *p = pattern, *n = string;
register UCHAR c;
])# _AC_LIBOBJ_FNMATCH
-# Additional prerequisites of lib/fnmatch.c, not part of _AC_LIBOBJ_FNMATCH.
-AC_DEFUN([gl_PREREQ_FNMATCH_EXTRA],
-[
- AC_REQUIRE([AC_HEADER_STDC])
- AC_CHECK_HEADERS_ONCE(string.h strings.h)
-])
-
-
AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
[
FNMATCH_H=
[rm -f lib/fnmatch.h],
[_AC_LIBOBJ_FNMATCH])
if test $ac_cv_func_fnmatch_posix != yes; then
- gl_PREREQ_FNMATCH_EXTRA
dnl We must choose a different name for our function, since on ELF systems
dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
dnl compiled into a shared library.
[rm -f lib/fnmatch.h],
[_AC_LIBOBJ_FNMATCH])
if test $ac_cv_func_fnmatch_gnu != yes; then
- gl_PREREQ_FNMATCH_EXTRA
dnl We must choose a different name for our function, since on ELF systems
dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
dnl compiled into a shared library.