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