glob.in.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /* glob.h -- Find a path matching a pattern.
  2. Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc.
  3. Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, see <https://www.gnu.org/licenses/>. */
  14. #ifndef _@GUARD_PREFIX@_GLOB_H
  15. #if __GNUC__ >= 3
  16. @PRAGMA_SYSTEM_HEADER@
  17. #endif
  18. @PRAGMA_COLUMNS@
  19. /* The include_next requires a split double-inclusion guard. */
  20. #if @HAVE_GLOB_H@ && !@REPLACE_GLOB@
  21. # @INCLUDE_NEXT@ @NEXT_GLOB_H@
  22. #endif
  23. #ifndef _@GUARD_PREFIX@_GLOB_H
  24. #define _@GUARD_PREFIX@_GLOB_H
  25. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  26. /* The definition of _GL_ARG_NONNULL is copied here. */
  27. /* The definition of _GL_WARN_ON_USE is copied here. */
  28. /* For plain 'restrict', use glibc's __restrict if defined.
  29. Otherwise, GCC 2.95 and later have "__restrict"; C99 compilers have
  30. "restrict", and "configure" may have defined "restrict".
  31. Other compilers use __restrict, __restrict__, and _Restrict, and
  32. 'configure' might #define 'restrict' to those words, so pick a
  33. different name. */
  34. #ifndef _Restrict_
  35. # if defined __restrict \
  36. || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
  37. || __clang_major__ >= 3
  38. # define _Restrict_ __restrict
  39. # elif 199901L <= __STDC_VERSION__ || defined restrict
  40. # define _Restrict_ restrict
  41. # else
  42. # define _Restrict_
  43. # endif
  44. #endif
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48. typedef int (*_gl_glob_errfunc_fn) (const char *, int);
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #if !@HAVE_GLOB_H@ || @REPLACE_GLOB@
  53. /* Preparations for including the standard GNU C Library header. */
  54. # include <libc-config.h>
  55. # include <stddef.h>
  56. /* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64".
  57. Make sure this definition is seen before glob-libc.h defines types that
  58. rely on 'struct stat'. */
  59. # include <sys/stat.h>
  60. # ifndef __USE_GNU
  61. # define __USE_GNU 1
  62. # endif
  63. # if @REPLACE_GLOB@
  64. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  65. # define glob rpl_glob
  66. # define globfree rpl_globfree
  67. # endif
  68. # endif
  69. # if @REPLACE_GLOB_PATTERN_P@
  70. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  71. # define glob_pattern_p rpl_glob_pattern_p
  72. # endif
  73. # endif
  74. # define __glob_pattern_p glob_pattern_p
  75. # define __GLOB_GNULIB 1
  76. /* Now the standard GNU C Library header should work. */
  77. # include "glob-libc.h"
  78. #endif
  79. #if @GNULIB_GLOB@
  80. # if @REPLACE_GLOB@
  81. _GL_FUNCDECL_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags,
  82. _gl_glob_errfunc_fn __errfunc,
  83. glob_t *_Restrict_ __pglob)
  84. _GL_ARG_NONNULL ((1)));
  85. _GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags,
  86. _gl_glob_errfunc_fn __errfunc,
  87. glob_t *_Restrict_ __pglob));
  88. # else
  89. # if !@HAVE_GLOB@
  90. _GL_FUNCDECL_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags,
  91. _gl_glob_errfunc_fn __errfunc,
  92. glob_t *_Restrict_ __pglob)
  93. _GL_ARG_NONNULL ((1)));
  94. # endif
  95. _GL_CXXALIAS_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags,
  96. _gl_glob_errfunc_fn __errfunc,
  97. glob_t *_Restrict_ __pglob));
  98. # endif
  99. _GL_CXXALIASWARN (glob);
  100. #elif defined GNULIB_POSIXCHECK
  101. # undef glob
  102. # if HAVE_RAW_DECL_GLOB
  103. _GL_WARN_ON_USE (glob,
  104. "glob is unportable - "
  105. "use gnulib module glob for portability");
  106. # endif
  107. #endif
  108. #if @GNULIB_GLOB@
  109. # if @REPLACE_GLOB@
  110. _GL_FUNCDECL_RPL (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1)));
  111. _GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob));
  112. # else
  113. # if !@HAVE_GLOB@
  114. _GL_FUNCDECL_SYS (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1)));
  115. # endif
  116. _GL_CXXALIAS_SYS (globfree, void, (glob_t *__pglob));
  117. # endif
  118. _GL_CXXALIASWARN (globfree);
  119. #elif defined GNULIB_POSIXCHECK
  120. # undef globfree
  121. # if HAVE_RAW_DECL_GLOBFREE
  122. _GL_WARN_ON_USE (globfree,
  123. "globfree is unportable - "
  124. "use gnulib module glob for portability");
  125. # endif
  126. #endif
  127. #if @GNULIB_GLOB@
  128. # if @REPLACE_GLOB_PATTERN_P@
  129. _GL_FUNCDECL_RPL (glob_pattern_p, int, (const char *__pattern, int __quote)
  130. _GL_ARG_NONNULL ((1)));
  131. _GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote));
  132. # else
  133. # if !@HAVE_GLOB_PATTERN_P@
  134. _GL_FUNCDECL_SYS (glob_pattern_p, int, (const char *__pattern, int __quote)
  135. _GL_ARG_NONNULL ((1)));
  136. # endif
  137. _GL_CXXALIAS_SYS (glob_pattern_p, int, (const char *__pattern, int __quote));
  138. # endif
  139. _GL_CXXALIASWARN (glob_pattern_p);
  140. #elif defined GNULIB_POSIXCHECK
  141. # undef glob_pattern_p
  142. # if HAVE_RAW_DECL_GLOB_PATTERN_P
  143. _GL_WARN_ON_USE (glob_pattern_p,
  144. "glob_pattern_p is unportable - "
  145. "use gnulib module glob for portability");
  146. # endif
  147. #endif
  148. #endif /* _@GUARD_PREFIX@_GLOB_H */
  149. #endif /* _@GUARD_PREFIX@_GLOB_H */