rpm 5.2.1
|
00001 /* Copyright (C) 1991, 92, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. 00002 00003 The GNU C Library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Library General Public License as 00005 published by the Free Software Foundation; either version 2 of the 00006 License, or (at your option) any later version. 00007 00008 The GNU C Library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public 00014 License along with the GNU C Library; see the file COPYING.LIB. If not, 00015 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. */ 00017 00018 #ifndef _GLOB_H 00019 #define _GLOB_H 1 00020 00021 #if defined(hpux) || defined(__hpux) 00022 #define _GLOB_INCLUDED 00023 #endif 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 #undef __ptr_t 00030 #if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32 00031 # if !defined __GLIBC__ || !defined __P || !defined __PMT 00032 # undef __P 00033 # undef __PMT 00034 # define __P(protos) protos 00035 # define __PMT(protos) protos 00036 # if !defined __GNUC__ || __GNUC__ < 2 00037 # undef __const 00038 # define __const const 00039 # endif 00040 # endif 00041 # define __ptr_t void * 00042 #else /* Not C++ or ANSI C. */ 00043 # undef __P 00044 # undef __PMT 00045 # define __P(protos) () 00046 # define __PMT(protos) () 00047 # undef __const 00048 # define __const 00049 # define __ptr_t char * 00050 #endif /* C++ or ANSI C. */ 00051 00052 /* We need `size_t' for the following definitions. */ 00053 #if !defined(__size_t) && !defined(_BSD_SIZE_T_DEFINED_) 00054 # if defined __GNUC__ && __GNUC__ >= 2 00055 typedef __SIZE_TYPE__ __size_t; 00056 # if 0 00057 # ifdef _XOPEN_SOURCE 00058 typedef __SIZE_TYPE__ size_t; 00059 # endif 00060 # endif 00061 # else 00062 /* This is a guess. */ 00063 typedef unsigned long int __size_t; 00064 # endif 00065 #else 00066 /* The GNU CC stddef.h version defines __size_t as empty. We need a real 00067 definition. */ 00068 # undef __size_t 00069 # define __size_t size_t 00070 #endif 00071 00072 /* Bits set in the FLAGS argument to `glob'. */ 00073 #define GLOB_ERR (1 << 0)/* Return on read errors. */ 00074 #define GLOB_MARK (1 << 1)/* Append a slash to each name. */ 00075 #define GLOB_NOSORT (1 << 2)/* Don't sort the names. */ 00076 #define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */ 00077 #define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */ 00078 #define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */ 00079 #define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ 00080 #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ 00081 00082 #if (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _BSD_SOURCE \ 00083 || defined _GNU_SOURCE) 00084 # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ 00085 # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ 00086 # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ 00087 # define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ 00088 # define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */ 00089 # define GLOB_ONLYDIR (1 << 13)/* Match only directories. */ 00090 # define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error 00091 if the user name is not available. */ 00092 # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ 00093 GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ 00094 GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ 00095 GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK) 00096 #else 00097 # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ 00098 GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ 00099 GLOB_PERIOD) 00100 #endif 00101 00102 /* Error returns from `glob'. */ 00103 #define GLOB_NOSPACE 1 /* Ran out of memory. */ 00104 #define GLOB_ABORTED 2 /* Read error. */ 00105 #define GLOB_NOMATCH 3 /* No matches found. */ 00106 #define GLOB_NOSYS 4 /* Not implemented. */ 00107 #ifdef _GNU_SOURCE 00108 /* Previous versions of this file defined GLOB_ABEND instead of 00109 GLOB_ABORTED. Provide a compatibility definition here. */ 00110 # define GLOB_ABEND GLOB_ABORTED 00111 #endif 00112 00113 /* Structure describing a globbing run. */ 00114 #if !defined _AMIGA && !defined VMS /* Buggy compiler. */ 00115 struct stat; 00116 #endif 00117 typedef struct 00118 { 00119 __size_t gl_pathc; /* Count of paths matched by the pattern. */ 00120 char **gl_pathv; /* List of matched pathnames. */ 00121 __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ 00122 int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ 00123 00124 /* If the GLOB_ALTDIRFUNC flag is set, the following functions 00125 are used instead of the normal file access functions. */ 00126 void (*gl_closedir) __PMT ((void *)) 00127 /*@*/; 00128 struct dirent *(*gl_readdir) __PMT ((void *)) 00129 /*@*/; 00130 __ptr_t (*gl_opendir) __PMT ((__const char *)) 00131 /*@*/; 00132 int (*gl_lstat) __PMT ((__const char *, struct stat *)) 00133 /*@*/; 00134 int (*gl_stat) __PMT ((__const char *, struct stat *)) 00135 /*@*/; 00136 } glob_t; 00137 00138 #ifdef _LARGEFILE64_SOURCE 00139 struct stat64; 00140 typedef struct 00141 { 00142 __size_t gl_pathc; 00143 char **gl_pathv; 00144 __size_t gl_offs; 00145 int gl_flags; 00146 00147 /* If the GLOB_ALTDIRFUNC flag is set, the following functions 00148 are used instead of the normal file access functions. */ 00149 void (*gl_closedir) __PMT ((void *)) 00150 /*@*/; 00151 struct dirent64 *(*gl_readdir) __PMT ((void *)) 00152 /*@*/; 00153 __ptr_t (*gl_opendir) __PMT ((__const char *)) 00154 /*@*/; 00155 int (*gl_lstat) __PMT ((__const char *, struct stat64 *)) 00156 /*@*/; 00157 int (*gl_stat) __PMT ((__const char *, struct stat64 *)) 00158 /*@*/; 00159 } glob64_t; 00160 #endif 00161 00162 /* Do glob searching for PATTERN, placing results in PGLOB. 00163 The bits defined above may be set in FLAGS. 00164 If a directory cannot be opened or read and ERRFUNC is not nil, 00165 it is called with the pathname that caused the error, and the 00166 `errno' value from the failing call; if it returns non-zero 00167 `glob' returns GLOB_ABEND; if it returns zero, the error is ignored. 00168 If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. 00169 Otherwise, `glob' returns zero. */ 00170 #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS != 64 00171 extern int glob __P ((__const char *__pattern, int __flags, 00172 int (*__errfunc) (__const char *, int), 00173 glob_t *__pglob)) 00174 /*@globals fileSystem @*/ 00175 /*@modifies fileSystem @*/; 00176 00177 /* Free storage allocated in PGLOB by a previous `glob' call. */ 00178 extern void globfree __P ((glob_t *__pglob)); 00179 #else 00180 # if defined(__GNUC__) && __GNUC__ >= 2 00181 extern int glob __P ((__const char *__pattern, int __flags, 00182 int (*__errfunc) (__const char *, int), 00183 glob_t *__pglob)) __asm__ ("glob64") 00184 /*@globals fileSystem @*/ 00185 /*@modifies fileSystem @*/; 00186 00187 extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64") 00188 /*@*/; 00189 # else 00190 # define glob glob64 00191 # define globfree globfree64 00192 # define glob_t glob64_t 00193 # endif 00194 #endif 00195 00196 #ifdef _LARGEFILE64_SOURCE 00197 /*@-protoparammatch -type @*/ 00198 extern int glob64 __P ((__const char *__pattern, int __flags, 00199 int (*__errfunc) (__const char *, int), 00200 glob64_t *__pglob)) 00201 /*@globals fileSystem @*/ 00202 /*@modifies fileSystem @*/; 00203 00204 extern void globfree64 __P ((glob64_t *__pglob)) 00205 /*@*/; 00206 /*@=protoparammatch =type @*/ 00207 #endif 00208 00209 00210 #ifdef _GNU_SOURCE 00211 /* Return nonzero if PATTERN contains any metacharacters. 00212 Metacharacters can be quoted with backslashes if QUOTE is nonzero. 00213 00214 This function is not part of the interface specified by POSIX.2 00215 but several programs want to use it. */ 00216 extern int glob_pattern_p __P ((__const char *__pattern, int __quote)) 00217 /*@*/; 00218 #endif 00219 00220 #ifdef __cplusplus 00221 } 00222 #endif 00223 00224 #endif /* glob.h */