Commit | Line | Data |
---|---|---|
6ec2e0f5 SDJ |
1 | /* glob.h -- Find a path matching a pattern. |
2 | ||
9c9d63b1 | 3 | Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. |
6ec2e0f5 SDJ |
4 | |
5 | Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU> | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3, or (at your option) | |
10 | any later version. | |
11 | ||
12 | This program 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 General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
c0c3707f | 18 | along with this program; if not, see <https://www.gnu.org/licenses/>. */ |
6ec2e0f5 | 19 | |
c0c3707f | 20 | #ifndef _@GUARD_PREFIX@_GLOB_H |
6ec2e0f5 | 21 | |
c0c3707f CB |
22 | #if __GNUC__ >= 3 |
23 | @PRAGMA_SYSTEM_HEADER@ | |
6ec2e0f5 | 24 | #endif |
c0c3707f | 25 | @PRAGMA_COLUMNS@ |
6ec2e0f5 | 26 | |
c0c3707f CB |
27 | /* The include_next requires a split double-inclusion guard. */ |
28 | #if @HAVE_GLOB_H@ && !@REPLACE_GLOB@ | |
29 | # @INCLUDE_NEXT@ @NEXT_GLOB_H@ | |
30 | #endif | |
7a6dbc2f | 31 | |
c0c3707f CB |
32 | #ifndef _@GUARD_PREFIX@_GLOB_H |
33 | #define _@GUARD_PREFIX@_GLOB_H | |
34 | ||
35 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | |
36 | ||
37 | /* The definition of _GL_ARG_NONNULL is copied here. */ | |
7a6dbc2f | 38 | |
c0c3707f CB |
39 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
40 | ||
698be2d8 CB |
41 | /* For plain 'restrict', use glibc's __restrict if defined. |
42 | Otherwise, GCC 2.95 and later have "__restrict"; C99 compilers have | |
c0c3707f CB |
43 | "restrict", and "configure" may have defined "restrict". |
44 | Other compilers use __restrict, __restrict__, and _Restrict, and | |
45 | 'configure' might #define 'restrict' to those words, so pick a | |
46 | different name. */ | |
47 | #ifndef _Restrict_ | |
9c9d63b1 PM |
48 | # if defined __restrict \ |
49 | || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ | |
50 | || __clang_major__ >= 3 | |
c0c3707f | 51 | # define _Restrict_ __restrict |
698be2d8 CB |
52 | # elif 199901L <= __STDC_VERSION__ || defined restrict |
53 | # define _Restrict_ restrict | |
6ec2e0f5 | 54 | # else |
c0c3707f | 55 | # define _Restrict_ |
6ec2e0f5 SDJ |
56 | # endif |
57 | #endif | |
c0c3707f CB |
58 | |
59 | #ifdef __cplusplus | |
60 | extern "C" { | |
6ec2e0f5 | 61 | #endif |
c0c3707f CB |
62 | typedef int (*_gl_glob_errfunc_fn) (const char *, int); |
63 | #ifdef __cplusplus | |
64 | } | |
6ec2e0f5 SDJ |
65 | #endif |
66 | ||
6ec2e0f5 | 67 | |
c0c3707f | 68 | #if !@HAVE_GLOB_H@ || @REPLACE_GLOB@ |
7a6dbc2f | 69 | |
6ec2e0f5 | 70 | |
c0c3707f CB |
71 | /* Preparations for including the standard GNU C Library header. */ |
72 | ||
73 | # include <libc-config.h> | |
74 | ||
75 | # include <stddef.h> | |
76 | ||
77 | /* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64". | |
78 | Make sure this definition is seen before glob-libc.h defines types that | |
79 | rely on 'struct stat'. */ | |
80 | # include <sys/stat.h> | |
6ec2e0f5 | 81 | |
c0c3707f CB |
82 | # ifndef __USE_GNU |
83 | # define __USE_GNU 1 | |
84 | # endif | |
7a6dbc2f | 85 | |
c0c3707f CB |
86 | # if @REPLACE_GLOB@ |
87 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
88 | # define glob rpl_glob | |
89 | # define globfree rpl_globfree | |
90 | # endif | |
91 | # endif | |
92 | # if @REPLACE_GLOB_PATTERN_P@ | |
93 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
94 | # define glob_pattern_p rpl_glob_pattern_p | |
95 | # endif | |
96 | # endif | |
97 | # define __glob_pattern_p glob_pattern_p | |
98 | ||
99 | # define __GLOB_GNULIB 1 | |
6ec2e0f5 | 100 | |
6ec2e0f5 SDJ |
101 | |
102 | /* Now the standard GNU C Library header should work. */ | |
c0c3707f | 103 | # include "glob-libc.h" |
7a6dbc2f SDJ |
104 | |
105 | ||
c0c3707f CB |
106 | #endif |
107 | ||
108 | ||
109 | #if @GNULIB_GLOB@ | |
110 | # if @REPLACE_GLOB@ | |
111 | _GL_FUNCDECL_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, | |
112 | _gl_glob_errfunc_fn __errfunc, | |
113 | glob_t *_Restrict_ __pglob) | |
114 | _GL_ARG_NONNULL ((1))); | |
6ec2e0f5 SDJ |
115 | _GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, |
116 | _gl_glob_errfunc_fn __errfunc, | |
117 | glob_t *_Restrict_ __pglob)); | |
c0c3707f CB |
118 | # else |
119 | # if !@HAVE_GLOB@ | |
120 | _GL_FUNCDECL_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags, | |
121 | _gl_glob_errfunc_fn __errfunc, | |
122 | glob_t *_Restrict_ __pglob) | |
123 | _GL_ARG_NONNULL ((1))); | |
124 | # endif | |
125 | _GL_CXXALIAS_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags, | |
126 | _gl_glob_errfunc_fn __errfunc, | |
127 | glob_t *_Restrict_ __pglob)); | |
128 | # endif | |
5e8754f9 | 129 | _GL_CXXALIASWARN (glob); |
c0c3707f CB |
130 | #elif defined GNULIB_POSIXCHECK |
131 | # undef glob | |
132 | # if HAVE_RAW_DECL_GLOB | |
133 | _GL_WARN_ON_USE (glob, | |
134 | "glob is unportable - " | |
135 | "use gnulib module glob for portability"); | |
136 | # endif | |
137 | #endif | |
138 | ||
139 | #if @GNULIB_GLOB@ | |
140 | # if @REPLACE_GLOB@ | |
141 | _GL_FUNCDECL_RPL (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1))); | |
142 | _GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob)); | |
143 | # else | |
144 | # if !@HAVE_GLOB@ | |
145 | _GL_FUNCDECL_SYS (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1))); | |
146 | # endif | |
147 | _GL_CXXALIAS_SYS (globfree, void, (glob_t *__pglob)); | |
148 | # endif | |
5e8754f9 | 149 | _GL_CXXALIASWARN (globfree); |
c0c3707f CB |
150 | #elif defined GNULIB_POSIXCHECK |
151 | # undef globfree | |
152 | # if HAVE_RAW_DECL_GLOBFREE | |
153 | _GL_WARN_ON_USE (globfree, | |
154 | "globfree is unportable - " | |
155 | "use gnulib module glob for portability"); | |
156 | # endif | |
157 | #endif | |
158 | ||
159 | #if @GNULIB_GLOB@ | |
160 | # if @REPLACE_GLOB_PATTERN_P@ | |
161 | _GL_FUNCDECL_RPL (glob_pattern_p, int, (const char *__pattern, int __quote) | |
162 | _GL_ARG_NONNULL ((1))); | |
163 | _GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote)); | |
164 | # else | |
165 | # if !@HAVE_GLOB_PATTERN_P@ | |
166 | _GL_FUNCDECL_SYS (glob_pattern_p, int, (const char *__pattern, int __quote) | |
167 | _GL_ARG_NONNULL ((1))); | |
168 | # endif | |
169 | _GL_CXXALIAS_SYS (glob_pattern_p, int, (const char *__pattern, int __quote)); | |
170 | # endif | |
6ec2e0f5 | 171 | _GL_CXXALIASWARN (glob_pattern_p); |
c0c3707f CB |
172 | #elif defined GNULIB_POSIXCHECK |
173 | # undef glob_pattern_p | |
174 | # if HAVE_RAW_DECL_GLOB_PATTERN_P | |
175 | _GL_WARN_ON_USE (glob_pattern_p, | |
176 | "glob_pattern_p is unportable - " | |
177 | "use gnulib module glob for portability"); | |
6ec2e0f5 SDJ |
178 | # endif |
179 | #endif | |
180 | ||
c0c3707f CB |
181 | |
182 | #endif /* _@GUARD_PREFIX@_GLOB_H */ | |
183 | #endif /* _@GUARD_PREFIX@_GLOB_H */ |