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