1 /* glob.h -- Find a path matching a pattern.
3 Copyright (C) 2005-2007, 2009-2018 Free Software Foundation, Inc.
5 Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU>
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 2, or (at your option)
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, see <https://www.gnu.org/licenses/>. */
20 #ifndef _@GUARD_PREFIX@_GLOB_H
23 @PRAGMA_SYSTEM_HEADER@
27 /* The include_next requires a split double-inclusion guard. */
28 #if @HAVE_GLOB_H@ && !@REPLACE_GLOB@
29 # @INCLUDE_NEXT@ @NEXT_GLOB_H@
32 #ifndef _@GUARD_PREFIX@_GLOB_H
33 #define _@GUARD_PREFIX@_GLOB_H
35 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
37 /* The definition of _GL_ARG_NONNULL is copied here. */
39 /* The definition of _GL_WARN_ON_USE is copied here. */
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
47 # if 199901L <= __STDC_VERSION__
48 # define _Restrict_ restrict
49 # elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
50 # define _Restrict_ __restrict
59 typedef int (*_gl_glob_errfunc_fn
) (const char *, int);
65 #if !@HAVE_GLOB_H@ || @REPLACE_GLOB@
68 /* Preparations for including the standard GNU C Library header. */
70 # include <libc-config.h>
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>
84 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
85 # define glob rpl_glob
86 # define globfree rpl_globfree
89 # if @REPLACE_GLOB_PATTERN_P@
90 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
91 # define glob_pattern_p rpl_glob_pattern_p
94 # define __glob_pattern_p glob_pattern_p
96 # define __GLOB_GNULIB 1
99 /* Now the standard GNU C Library header should work. */
100 # include "glob-libc.h"
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)));
112 _GL_CXXALIAS_RPL (glob
, int, (const char *_Restrict_ __pattern
, int __flags
,
113 _gl_glob_errfunc_fn __errfunc
,
114 glob_t
*_Restrict_ __pglob
));
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)));
122 _GL_CXXALIAS_SYS (glob
, int, (const char *_Restrict_ __pattern
, int __flags
,
123 _gl_glob_errfunc_fn __errfunc
,
124 glob_t
*_Restrict_ __pglob
));
126 _GL_CXXALIASWARN (glob
);
127 #elif defined GNULIB_POSIXCHECK
129 # if HAVE_RAW_DECL_GLOB
130 _GL_WARN_ON_USE (glob
,
131 "glob is unportable - "
132 "use gnulib module glob for portability");
138 _GL_FUNCDECL_RPL (globfree
, void, (glob_t
*__pglob
) _GL_ARG_NONNULL ((1)));
139 _GL_CXXALIAS_RPL (globfree
, void, (glob_t
*__pglob
));
142 _GL_FUNCDECL_SYS (globfree
, void, (glob_t
*__pglob
) _GL_ARG_NONNULL ((1)));
144 _GL_CXXALIAS_SYS (globfree
, void, (glob_t
*__pglob
));
146 _GL_CXXALIASWARN (globfree
);
147 #elif defined GNULIB_POSIXCHECK
149 # if HAVE_RAW_DECL_GLOBFREE
150 _GL_WARN_ON_USE (globfree
,
151 "globfree is unportable - "
152 "use gnulib module glob for portability");
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
));
162 # if !@HAVE_GLOB_PATTERN_P@
163 _GL_FUNCDECL_SYS (glob_pattern_p
, int, (const char *__pattern
, int __quote
)
164 _GL_ARG_NONNULL ((1)));
166 _GL_CXXALIAS_SYS (glob_pattern_p
, int, (const char *__pattern
, int __quote
));
168 _GL_CXXALIASWARN (glob_pattern_p
);
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");
179 #endif /* _@GUARD_PREFIX@_GLOB_H */
180 #endif /* _@GUARD_PREFIX@_GLOB_H */