| 1 | /* glob.h -- Find a path matching a pattern. |
| 2 | |
| 3 | Copyright (C) 2005-2007, 2009-2019 Free Software Foundation, Inc. |
| 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 |
| 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 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
| 36 | |
| 37 | /* The definition of _GL_ARG_NONNULL is copied here. */ |
| 38 | |
| 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 |
| 51 | # else |
| 52 | # define _Restrict_ |
| 53 | # endif |
| 54 | #endif |
| 55 | |
| 56 | #ifdef __cplusplus |
| 57 | extern "C" { |
| 58 | #endif |
| 59 | typedef int (*_gl_glob_errfunc_fn) (const char *, int); |
| 60 | #ifdef __cplusplus |
| 61 | } |
| 62 | #endif |
| 63 | |
| 64 | |
| 65 | #if !@HAVE_GLOB_H@ || @REPLACE_GLOB@ |
| 66 | |
| 67 | |
| 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> |
| 78 | |
| 79 | # ifndef __USE_GNU |
| 80 | # define __USE_GNU 1 |
| 81 | # endif |
| 82 | |
| 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 |
| 97 | |
| 98 | |
| 99 | /* Now the standard GNU C Library header should work. */ |
| 100 | # include "glob-libc.h" |
| 101 | |
| 102 | |
| 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))); |
| 112 | _GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, |
| 113 | _gl_glob_errfunc_fn __errfunc, |
| 114 | glob_t *_Restrict_ __pglob)); |
| 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 |
| 126 | _GL_CXXALIASWARN (glob); |
| 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 |
| 146 | _GL_CXXALIASWARN (globfree); |
| 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 |
| 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"); |
| 175 | # endif |
| 176 | #endif |
| 177 | |
| 178 | |
| 179 | #endif /* _@GUARD_PREFIX@_GLOB_H */ |
| 180 | #endif /* _@GUARD_PREFIX@_GLOB_H */ |