1 /* glob.h -- Find a path matching a pattern.
3 Copyright (C) 2005-2007, 2009-2022 Free Software Foundation, Inc.
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.
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.
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/>. */
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 /* For plain 'restrict', use glibc's __restrict if defined.
42 Otherwise, GCC 2.95 and later have "__restrict"; C99 compilers have
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
48 # if defined __restrict \
49 || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
50 || __clang_major__ >= 3
51 # define _Restrict_ __restrict
52 # elif 199901L <= __STDC_VERSION__ || defined restrict
53 # define _Restrict_ restrict
62 typedef int (*_gl_glob_errfunc_fn) (const char *, int);
68 #if !@HAVE_GLOB_H@ || @REPLACE_GLOB@
71 /* Preparations for including the standard GNU C Library header. */
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>
81 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
82 # define glob rpl_glob
83 # define globfree rpl_globfree
86 # if @REPLACE_GLOB_PATTERN_P@
87 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
88 # define glob_pattern_p rpl_glob_pattern_p
91 # define __glob_pattern_p glob_pattern_p
93 # define __GLOB_GNULIB 1
96 /* Now the standard GNU C Library header should work. */
97 # include "glob-libc.gl.h"
105 _GL_FUNCDECL_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags,
106 _gl_glob_errfunc_fn __errfunc,
107 glob_t *_Restrict_ __pglob)
108 _GL_ARG_NONNULL ((1)));
109 _GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags,
110 _gl_glob_errfunc_fn __errfunc,
111 glob_t *_Restrict_ __pglob));
114 _GL_FUNCDECL_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags,
115 _gl_glob_errfunc_fn __errfunc,
116 glob_t *_Restrict_ __pglob)
117 _GL_ARG_NONNULL ((1)));
119 _GL_CXXALIAS_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags,
120 _gl_glob_errfunc_fn __errfunc,
121 glob_t *_Restrict_ __pglob));
123 _GL_CXXALIASWARN (glob);
124 #elif defined GNULIB_POSIXCHECK
126 # if HAVE_RAW_DECL_GLOB
127 _GL_WARN_ON_USE (glob,
128 "glob is unportable - "
129 "use gnulib module glob for portability");
135 _GL_FUNCDECL_RPL (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1)));
136 _GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob));
139 _GL_FUNCDECL_SYS (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1)));
141 _GL_CXXALIAS_SYS (globfree, void, (glob_t *__pglob));
143 _GL_CXXALIASWARN (globfree);
144 #elif defined GNULIB_POSIXCHECK
146 # if HAVE_RAW_DECL_GLOBFREE
147 _GL_WARN_ON_USE (globfree,
148 "globfree is unportable - "
149 "use gnulib module glob for portability");
154 # if @REPLACE_GLOB_PATTERN_P@
155 _GL_FUNCDECL_RPL (glob_pattern_p, int, (const char *__pattern, int __quote)
156 _GL_ARG_NONNULL ((1)));
157 _GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote));
159 # if !@HAVE_GLOB_PATTERN_P@
160 _GL_FUNCDECL_SYS (glob_pattern_p, int, (const char *__pattern, int __quote)
161 _GL_ARG_NONNULL ((1)));
163 _GL_CXXALIAS_SYS (glob_pattern_p, int, (const char *__pattern, int __quote));
165 _GL_CXXALIASWARN (glob_pattern_p);
166 #elif defined GNULIB_POSIXCHECK
167 # undef glob_pattern_p
168 # if HAVE_RAW_DECL_GLOB_PATTERN_P
169 _GL_WARN_ON_USE (glob_pattern_p,
170 "glob_pattern_p is unportable - "
171 "use gnulib module glob for portability");
176 #endif /* _@GUARD_PREFIX@_GLOB_H */
177 #endif /* _@GUARD_PREFIX@_GLOB_H */