1 | /* Substitute for and wrapper around <fnmatch.h>.
|
---|
2 | Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2021 Free
|
---|
3 | Software Foundation, Inc.
|
---|
4 |
|
---|
5 | This file is part of the GNU C Library.
|
---|
6 |
|
---|
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.
|
---|
11 |
|
---|
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.
|
---|
16 |
|
---|
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/>. */
|
---|
19 |
|
---|
20 | #ifndef _@GUARD_PREFIX@_FNMATCH_H
|
---|
21 |
|
---|
22 | #if __GNUC__ >= 3
|
---|
23 | @PRAGMA_SYSTEM_HEADER@
|
---|
24 | #endif
|
---|
25 | @PRAGMA_COLUMNS@
|
---|
26 |
|
---|
27 | /* The include_next requires a split double-inclusion guard. */
|
---|
28 | #if @HAVE_FNMATCH_H@ && !@REPLACE_FNMATCH@
|
---|
29 | # @INCLUDE_NEXT@ @NEXT_FNMATCH_H@
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #ifndef _@GUARD_PREFIX@_FNMATCH_H
|
---|
33 | #define _@GUARD_PREFIX@_FNMATCH_H
|
---|
34 |
|
---|
35 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
---|
36 |
|
---|
37 | /* The definition of _GL_ARG_NONNULL is copied here. */
|
---|
38 |
|
---|
39 | /* The definition of _GL_WARN_ON_USE is copied here. */
|
---|
40 |
|
---|
41 | #if !@HAVE_FNMATCH_H@ || @REPLACE_FNMATCH@
|
---|
42 |
|
---|
43 | /* We #undef these before defining them because some losing systems
|
---|
44 | (HP-UX A.08.07 for example) define these in <unistd.h>. */
|
---|
45 | #undef FNM_PATHNAME
|
---|
46 | #undef FNM_NOESCAPE
|
---|
47 | #undef FNM_PERIOD
|
---|
48 |
|
---|
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. */
|
---|
53 |
|
---|
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. */
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | /* Value returned by 'fnmatch' if STRING does not match PATTERN. */
|
---|
62 | #define FNM_NOMATCH 1
|
---|
63 |
|
---|
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
|
---|
67 | to be defined. */
|
---|
68 | #ifdef _XOPEN_SOURCE
|
---|
69 | # define FNM_NOSYS (-1)
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | #endif
|
---|
73 |
|
---|
74 |
|
---|
75 | #if @GNULIB_FNMATCH@
|
---|
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
|
---|
81 | # endif
|
---|
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));
|
---|
87 | # else
|
---|
88 | # if !@HAVE_FNMATCH@
|
---|
89 | _GL_FUNCDECL_SYS (fnmatch, int,
|
---|
90 | (const char *pattern, const char *name, int flags)
|
---|
91 | _GL_ARG_NONNULL ((1, 2)));
|
---|
92 | # endif
|
---|
93 | _GL_CXXALIAS_SYS (fnmatch, int,
|
---|
94 | (const char *pattern, const char *name, int flags));
|
---|
95 | # endif
|
---|
96 | # if !GNULIB_FNMATCH_GNU && __GLIBC__ >= 2
|
---|
97 | _GL_CXXALIASWARN (fnmatch);
|
---|
98 | # endif
|
---|
99 | #elif defined GNULIB_POSIXCHECK
|
---|
100 | # undef fnmatch
|
---|
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");
|
---|
105 | # endif
|
---|
106 | #endif
|
---|
107 |
|
---|
108 |
|
---|
109 | #endif /* _@GUARD_PREFIX@_FNMATCH_H */
|
---|
110 | #endif /* _@GUARD_PREFIX@_FNMATCH_H */
|
---|