1  /* glob.h -- Find a path matching a pattern.
       2  
       3     Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc.
       4  
       5     Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU>
       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  # undef glob
     133  # if HAVE_RAW_DECL_GLOB
     134  _GL_WARN_ON_USE (glob,
     135                   "glob is unportable - "
     136                   "use gnulib module glob for portability");
     137  # endif
     138  #endif
     139  
     140  #if @GNULIB_GLOB@
     141  # if @REPLACE_GLOB@
     142  _GL_FUNCDECL_RPL (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1)));
     143  _GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob));
     144  # else
     145  #  if !@HAVE_GLOB@
     146  _GL_FUNCDECL_SYS (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1)));
     147  #  endif
     148  _GL_CXXALIAS_SYS (globfree, void, (glob_t *__pglob));
     149  # endif
     150  _GL_CXXALIASWARN (globfree);
     151  #elif defined GNULIB_POSIXCHECK
     152  # undef globfree
     153  # if HAVE_RAW_DECL_GLOBFREE
     154  _GL_WARN_ON_USE (globfree,
     155                   "globfree is unportable - "
     156                   "use gnulib module glob for portability");
     157  # endif
     158  #endif
     159  
     160  #if @GNULIB_GLOB@
     161  # if @REPLACE_GLOB_PATTERN_P@
     162  _GL_FUNCDECL_RPL (glob_pattern_p, int, (const char *__pattern, int __quote)
     163                                         _GL_ARG_NONNULL ((1)));
     164  _GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote));
     165  # else
     166  #  if !@HAVE_GLOB_PATTERN_P@
     167  _GL_FUNCDECL_SYS (glob_pattern_p, int, (const char *__pattern, int __quote)
     168                                         _GL_ARG_NONNULL ((1)));
     169  #  endif
     170  _GL_CXXALIAS_SYS (glob_pattern_p, int, (const char *__pattern, int __quote));
     171  # endif
     172  _GL_CXXALIASWARN (glob_pattern_p);
     173  #elif defined GNULIB_POSIXCHECK
     174  # undef glob_pattern_p
     175  # if HAVE_RAW_DECL_GLOB_PATTERN_P
     176  _GL_WARN_ON_USE (glob_pattern_p,
     177                   "glob_pattern_p is unportable - "
     178                   "use gnulib module glob for portability");
     179  # endif
     180  #endif
     181  
     182  
     183  #endif /* _@GUARD_PREFIX@_GLOB_H */
     184  #endif /* _@GUARD_PREFIX@_GLOB_H */