1 /* Substitute for and wrapper around <fnmatch.h>.
2 Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2024 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 /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
36 #if !_GL_CONFIG_H_INCLUDED
37 #error "Please include config.h first."
40 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
42 /* The definition of _GL_ARG_NONNULL is copied here. */
44 /* The definition of _GL_WARN_ON_USE is copied here. */
46 #if !@HAVE_FNMATCH_H@ || @REPLACE_FNMATCH@
48 /* We #undef these before defining them because some losing systems
49 (HP-UX A.08.07 for example) define these in <unistd.h>. */
54 /* Bits set in the FLAGS argument to 'fnmatch'. */
55 #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match '/'. */
56 #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
57 #define FNM_PERIOD (1 << 2) /* Leading '.' is matched only explicitly. */
59 #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
60 # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
61 # define FNM_LEADING_DIR (1 << 3) /* Ignore '/...' after a match. */
62 # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
63 # define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
66 /* Value returned by 'fnmatch' if STRING does not match PATTERN. */
69 /* This value is returned if the implementation does not support
70 'fnmatch'. Since this is not the case here it will never be
71 returned but the conformance test suites still require the symbol
74 # define FNM_NOSYS (-1)
81 /* Match NAME against the file name pattern PATTERN,
82 returning zero if it matches, FNM_NOMATCH if not. */
83 # if @REPLACE_FNMATCH@
84 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
85 # define fnmatch rpl_fnmatch
87 # define GNULIB_defined_fnmatch_function 1
88 _GL_FUNCDECL_RPL (fnmatch
, int,
89 (const char *pattern
, const char *name
, int flags
)
90 _GL_ARG_NONNULL ((1, 2)));
91 _GL_CXXALIAS_RPL (fnmatch
, int,
92 (const char *pattern
, const char *name
, int flags
));
95 # define GNULIB_defined_fnmatch_function 1
96 _GL_FUNCDECL_SYS (fnmatch
, int,
97 (const char *pattern
, const char *name
, int flags
)
98 _GL_ARG_NONNULL ((1, 2)));
100 _GL_CXXALIAS_SYS (fnmatch
, int,
101 (const char *pattern
, const char *name
, int flags
));
103 # if !GNULIB_FNMATCH_GNU && __GLIBC__ >= 2
104 _GL_CXXALIASWARN (fnmatch
);
106 #elif defined GNULIB_POSIXCHECK
108 # if HAVE_RAW_DECL_FNMATCH
109 _GL_WARN_ON_USE (fnmatch
,
110 "fnmatch does not portably work - "
111 "use gnulib module fnmatch for portability or gnulib module fnmatch-gnu for a glibc compatible implementation");
116 #endif /* _@GUARD_PREFIX@_FNMATCH_H */
117 #endif /* _@GUARD_PREFIX@_FNMATCH_H */