Commit | Line | Data |
---|---|---|
6ec2e0f5 SDJ |
1 | /* glob.h -- Find a path matching a pattern. |
2 | ||
c0c3707f | 3 | Copyright (C) 2005-2007, 2009-2019 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 | ||
41 | /* GCC 2.95 and later have "__restrict"; C99 compilers have | |
42 | "restrict", and "configure" may have defined "restrict". | |
43 | Other compilers use __restrict, __restrict__, and _Restrict, and | |
44 | 'configure' might #define 'restrict' to those words, so pick a | |
45 | different name. */ | |
46 | #ifndef _Restrict_ | |
47 | # if 199901L <= __STDC_VERSION__ | |
48 | # define _Restrict_ restrict | |
49 | # elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__) | |
50 | # define _Restrict_ __restrict | |
6ec2e0f5 | 51 | # else |
c0c3707f | 52 | # define _Restrict_ |
6ec2e0f5 SDJ |
53 | # endif |
54 | #endif | |
c0c3707f CB |
55 | |
56 | #ifdef __cplusplus | |
57 | extern "C" { | |
6ec2e0f5 | 58 | #endif |
c0c3707f CB |
59 | typedef int (*_gl_glob_errfunc_fn) (const char *, int); |
60 | #ifdef __cplusplus | |
61 | } | |
6ec2e0f5 SDJ |
62 | #endif |
63 | ||
6ec2e0f5 | 64 | |
c0c3707f | 65 | #if !@HAVE_GLOB_H@ || @REPLACE_GLOB@ |
7a6dbc2f | 66 | |
6ec2e0f5 | 67 | |
c0c3707f CB |
68 | /* Preparations for including the standard GNU C Library header. */ |
69 | ||
70 | # include <libc-config.h> | |
71 | ||
72 | # include <stddef.h> | |
73 | ||
74 | /* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64". | |
75 | Make sure this definition is seen before glob-libc.h defines types that | |
76 | rely on 'struct stat'. */ | |
77 | # include <sys/stat.h> | |
6ec2e0f5 | 78 | |
c0c3707f CB |
79 | # ifndef __USE_GNU |
80 | # define __USE_GNU 1 | |
81 | # endif | |
7a6dbc2f | 82 | |
c0c3707f CB |
83 | # if @REPLACE_GLOB@ |
84 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
85 | # define glob rpl_glob | |
86 | # define globfree rpl_globfree | |
87 | # endif | |
88 | # endif | |
89 | # if @REPLACE_GLOB_PATTERN_P@ | |
90 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
91 | # define glob_pattern_p rpl_glob_pattern_p | |
92 | # endif | |
93 | # endif | |
94 | # define __glob_pattern_p glob_pattern_p | |
95 | ||
96 | # define __GLOB_GNULIB 1 | |
6ec2e0f5 | 97 | |
6ec2e0f5 SDJ |
98 | |
99 | /* Now the standard GNU C Library header should work. */ | |
c0c3707f | 100 | # include "glob-libc.h" |
7a6dbc2f SDJ |
101 | |
102 | ||
c0c3707f CB |
103 | #endif |
104 | ||
105 | ||
106 | #if @GNULIB_GLOB@ | |
107 | # if @REPLACE_GLOB@ | |
108 | _GL_FUNCDECL_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, | |
109 | _gl_glob_errfunc_fn __errfunc, | |
110 | glob_t *_Restrict_ __pglob) | |
111 | _GL_ARG_NONNULL ((1))); | |
6ec2e0f5 SDJ |
112 | _GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, |
113 | _gl_glob_errfunc_fn __errfunc, | |
114 | glob_t *_Restrict_ __pglob)); | |
c0c3707f CB |
115 | # else |
116 | # if !@HAVE_GLOB@ | |
117 | _GL_FUNCDECL_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags, | |
118 | _gl_glob_errfunc_fn __errfunc, | |
119 | glob_t *_Restrict_ __pglob) | |
120 | _GL_ARG_NONNULL ((1))); | |
121 | # endif | |
122 | _GL_CXXALIAS_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags, | |
123 | _gl_glob_errfunc_fn __errfunc, | |
124 | glob_t *_Restrict_ __pglob)); | |
125 | # endif | |
5e8754f9 | 126 | _GL_CXXALIASWARN (glob); |
c0c3707f CB |
127 | #elif defined GNULIB_POSIXCHECK |
128 | # undef glob | |
129 | # if HAVE_RAW_DECL_GLOB | |
130 | _GL_WARN_ON_USE (glob, | |
131 | "glob is unportable - " | |
132 | "use gnulib module glob for portability"); | |
133 | # endif | |
134 | #endif | |
135 | ||
136 | #if @GNULIB_GLOB@ | |
137 | # if @REPLACE_GLOB@ | |
138 | _GL_FUNCDECL_RPL (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1))); | |
139 | _GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob)); | |
140 | # else | |
141 | # if !@HAVE_GLOB@ | |
142 | _GL_FUNCDECL_SYS (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1))); | |
143 | # endif | |
144 | _GL_CXXALIAS_SYS (globfree, void, (glob_t *__pglob)); | |
145 | # endif | |
5e8754f9 | 146 | _GL_CXXALIASWARN (globfree); |
c0c3707f CB |
147 | #elif defined GNULIB_POSIXCHECK |
148 | # undef globfree | |
149 | # if HAVE_RAW_DECL_GLOBFREE | |
150 | _GL_WARN_ON_USE (globfree, | |
151 | "globfree is unportable - " | |
152 | "use gnulib module glob for portability"); | |
153 | # endif | |
154 | #endif | |
155 | ||
156 | #if @GNULIB_GLOB@ | |
157 | # if @REPLACE_GLOB_PATTERN_P@ | |
158 | _GL_FUNCDECL_RPL (glob_pattern_p, int, (const char *__pattern, int __quote) | |
159 | _GL_ARG_NONNULL ((1))); | |
160 | _GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote)); | |
161 | # else | |
162 | # if !@HAVE_GLOB_PATTERN_P@ | |
163 | _GL_FUNCDECL_SYS (glob_pattern_p, int, (const char *__pattern, int __quote) | |
164 | _GL_ARG_NONNULL ((1))); | |
165 | # endif | |
166 | _GL_CXXALIAS_SYS (glob_pattern_p, int, (const char *__pattern, int __quote)); | |
167 | # endif | |
6ec2e0f5 | 168 | _GL_CXXALIASWARN (glob_pattern_p); |
c0c3707f CB |
169 | #elif defined GNULIB_POSIXCHECK |
170 | # undef glob_pattern_p | |
171 | # if HAVE_RAW_DECL_GLOB_PATTERN_P | |
172 | _GL_WARN_ON_USE (glob_pattern_p, | |
173 | "glob_pattern_p is unportable - " | |
174 | "use gnulib module glob for portability"); | |
6ec2e0f5 SDJ |
175 | # endif |
176 | #endif | |
177 | ||
c0c3707f CB |
178 | |
179 | #endif /* _@GUARD_PREFIX@_GLOB_H */ | |
180 | #endif /* _@GUARD_PREFIX@_GLOB_H */ |