| 1 |
/* glob.h -- Find a path matching a pattern. |
| 2 |
|
| 3 |
Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc. |
| 4 |
|
| 5 |
Written by Derek Price <[email protected]> & Paul Eggert <[email protected]> |
| 6 |
|
| 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. |
| 11 |
|
| 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. |
| 16 |
|
| 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/>. */ |
| 19 |
|
| 20 |
#ifndef _@GUARD_PREFIX@_GLOB_H |
| 21 |
|
| 22 |
#if __GNUC__ >= 3 |
| 23 |
@PRAGMA_SYSTEM_HEADER@ |
| 24 |
#endif |
| 25 |
@PRAGMA_COLUMNS@ |
| 26 |
|
| 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 |
| 31 |
|
| 32 |
#ifndef _@GUARD_PREFIX@_GLOB_H |
| 33 |
#define _@GUARD_PREFIX@_GLOB_H |
| 34 |
|
| 35 |
/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ |
| 36 |
#if !_GL_CONFIG_H_INCLUDED |
| 37 |
#error "Please include config.h first." |
| 38 |
#endif |
| 39 |
|
| 40 |
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
| 41 |
|
| 42 |
/* The definition of _GL_ARG_NONNULL is copied here. */ |
| 43 |
|
| 44 |
/* The definition of _GL_WARN_ON_USE is copied here. */ |
| 45 |
|
| 46 |
/* For plain 'restrict', use glibc's __restrict if defined. |
| 47 |
Otherwise, GCC 2.95 and later have "__restrict"; C99 compilers have |
| 48 |
"restrict", and "configure" may have defined "restrict". |
| 49 |
Other compilers use __restrict, __restrict__, and _Restrict, and |
| 50 |
'configure' might #define 'restrict' to those words, so pick a |
| 51 |
different name. */ |
| 52 |
#ifndef _Restrict_ |
| 53 |
# if defined __restrict \ |
| 54 |
|| 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ |
| 55 |
|| __clang_major__ >= 3 |
| 56 |
# define _Restrict_ __restrict |
| 57 |
# elif 199901L <= __STDC_VERSION__ || defined restrict |
| 58 |
# define _Restrict_ restrict |
| 59 |
# else |
| 60 |
# define _Restrict_ |
| 61 |
# endif |
| 62 |
#endif |
| 63 |
|
| 64 |
#ifdef __cplusplus |
| 65 |
extern "C" { |
| 66 |
#endif |
| 67 |
typedef int (*_gl_glob_errfunc_fn) (const char *, int); |
| 68 |
#ifdef __cplusplus |
| 69 |
} |
| 70 |
#endif |
| 71 |
|
| 72 |
|
| 73 |
#if !@HAVE_GLOB_H@ || @REPLACE_GLOB@ |
| 74 |
|
| 75 |
|
| 76 |
/* Preparations for including the standard GNU C Library header. */ |
| 77 |
|
| 78 |
# include <stddef.h> |
| 79 |
|
| 80 |
/* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64". |
| 81 |
Make sure this definition is seen before glob-libc.h defines types that |
| 82 |
rely on 'struct stat'. */ |
| 83 |
# include <sys/stat.h> |
| 84 |
|
| 85 |
# if @REPLACE_GLOB@ |
| 86 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 87 |
# define glob rpl_glob |
| 88 |
# define globfree rpl_globfree |
| 89 |
# endif |
| 90 |
# endif |
| 91 |
# if @REPLACE_GLOB_PATTERN_P@ |
| 92 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 93 |
# define glob_pattern_p rpl_glob_pattern_p |
| 94 |
# endif |
| 95 |
# endif |
| 96 |
# define __glob_pattern_p glob_pattern_p |
| 97 |
|
| 98 |
# define __GLOB_GNULIB 1 |
| 99 |
|
| 100 |
|
| 101 |
/* Now the standard GNU C Library header should work. */ |
| 102 |
# include "glob-libc.gl.h" |
| 103 |
|
| 104 |
|
| 105 |
#endif |
| 106 |
|
| 107 |
|
| 108 |
#if @GNULIB_GLOB@ |
| 109 |
# if @REPLACE_GLOB@ |
| 110 |
_GL_FUNCDECL_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, |
| 111 |
_gl_glob_errfunc_fn __errfunc, |
| 112 |
glob_t *_Restrict_ __pglob), |
| 113 |
_GL_ARG_NONNULL ((1))); |
| 114 |
_GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, |
| 115 |
_gl_glob_errfunc_fn __errfunc, |
| 116 |
glob_t *_Restrict_ __pglob)); |
| 117 |
# else |
| 118 |
# if !@HAVE_GLOB@ |
| 119 |
_GL_FUNCDECL_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags, |
| 120 |
_gl_glob_errfunc_fn __errfunc, |
| 121 |
glob_t *_Restrict_ __pglob), |
| 122 |
_GL_ARG_NONNULL ((1))); |
| 123 |
# endif |
| 124 |
_GL_CXXALIAS_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags, |
| 125 |
_gl_glob_errfunc_fn __errfunc, |
| 126 |
glob_t *_Restrict_ __pglob)); |
| 127 |
# endif |
| 128 |
# if __GLIBC__ >= 2 |
| 129 |
_GL_CXXALIASWARN (glob); |
| 130 |
# endif |
| 131 |
#elif defined GNULIB_POSIXCHECK |
| 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 |
| 149 |
_GL_CXXALIASWARN (globfree); |
| 150 |
#elif defined GNULIB_POSIXCHECK |
| 151 |
# if HAVE_RAW_DECL_GLOBFREE |
| 152 |
_GL_WARN_ON_USE (globfree, |
| 153 |
"globfree is unportable - " |
| 154 |
"use gnulib module glob for portability"); |
| 155 |
# endif |
| 156 |
#endif |
| 157 |
|
| 158 |
#if @GNULIB_GLOB@ |
| 159 |
# if @REPLACE_GLOB_PATTERN_P@ |
| 160 |
_GL_FUNCDECL_RPL (glob_pattern_p, int, (const char *__pattern, int __quote), |
| 161 |
_GL_ARG_NONNULL ((1))); |
| 162 |
_GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote)); |
| 163 |
# else |
| 164 |
# if !@HAVE_GLOB_PATTERN_P@ |
| 165 |
_GL_FUNCDECL_SYS (glob_pattern_p, int, (const char *__pattern, int __quote), |
| 166 |
_GL_ARG_NONNULL ((1))); |
| 167 |
# endif |
| 168 |
_GL_CXXALIAS_SYS (glob_pattern_p, int, (const char *__pattern, int __quote)); |
| 169 |
# endif |
| 170 |
_GL_CXXALIASWARN (glob_pattern_p); |
| 171 |
#elif defined GNULIB_POSIXCHECK |
| 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"); |
| 176 |
# endif |
| 177 |
#endif |
| 178 |
|
| 179 |
|
| 180 |
#endif /* _@GUARD_PREFIX@_GLOB_H */ |
| 181 |
#endif /* _@GUARD_PREFIX@_GLOB_H */ |