1 /* Substitute for and wrapper around <fnmatch.h>.
2 Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2022 Free
3 Software Foundation, Inc.
5 This file is part of the GNU C Library.
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
20 #ifndef _@GUARD_PREFIX@_FNMATCH_H
23 @PRAGMA_SYSTEM_HEADER@
27 /* The include_next requires a split double-inclusion guard. */
28 #if @HAVE_FNMATCH_H@ && !@REPLACE_FNMATCH@
29 # @INCLUDE_NEXT@ @NEXT_FNMATCH_H@
32 #ifndef _@GUARD_PREFIX@_FNMATCH_H
33 #define _@GUARD_PREFIX@_FNMATCH_H
35 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
37 /* The definition of _GL_ARG_NONNULL is copied here. */
39 /* The definition of _GL_WARN_ON_USE is copied here. */
41 #if !@HAVE_FNMATCH_H@ || @REPLACE_FNMATCH@
43 /* We #undef these before defining them because some losing systems
44 (HP-UX A.08.07 for example) define these in <unistd.h>. */
49 /* Bits set in the FLAGS argument to 'fnmatch'. */
50 #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match '/'. */
51 #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
52 #define FNM_PERIOD (1 << 2) /* Leading '.' is matched only explicitly. */
54 #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
55 # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
56 # define FNM_LEADING_DIR (1 << 3) /* Ignore '/...' after a match. */
57 # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
58 # define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
61 /* Value returned by 'fnmatch' if STRING does not match PATTERN. */
64 /* This value is returned if the implementation does not support
65 'fnmatch'. Since this is not the case here it will never be
66 returned but the conformance test suites still require the symbol
69 # define FNM_NOSYS (-1)
76 /* Match NAME against the file name pattern PATTERN,
77 returning zero if it matches, FNM_NOMATCH if not. */
78 # if @REPLACE_FNMATCH@
79 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
80 # define fnmatch rpl_fnmatch
82 _GL_FUNCDECL_RPL (fnmatch
, int,
83 (const char *pattern
, const char *name
, int flags
)
84 _GL_ARG_NONNULL ((1, 2)));
85 _GL_CXXALIAS_RPL (fnmatch
, int,
86 (const char *pattern
, const char *name
, int flags
));
89 _GL_FUNCDECL_SYS (fnmatch
, int,
90 (const char *pattern
, const char *name
, int flags
)
91 _GL_ARG_NONNULL ((1, 2)));
93 _GL_CXXALIAS_SYS (fnmatch
, int,
94 (const char *pattern
, const char *name
, int flags
));
96 # if !GNULIB_FNMATCH_GNU && __GLIBC__ >= 2
97 _GL_CXXALIASWARN (fnmatch
);
99 #elif defined GNULIB_POSIXCHECK
101 # if HAVE_RAW_DECL_FNMATCH
102 _GL_WARN_ON_USE (fnmatch
,
103 "fnmatch does not portably work - "
104 "use gnulib module fnmatch for portability or gnulib module fnmatch-gnu for a glibc compatible implementation");
109 #endif /* _@GUARD_PREFIX@_FNMATCH_H */
110 #endif /* _@GUARD_PREFIX@_FNMATCH_H */