1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef _GLOB_H
19 #define _GLOB_H 1
20
21 #ifndef __GLOB_GNULIB
22 # include <sys/cdefs.h>
23 #endif
24
25 __BEGIN_DECLS
26
27 #define __need_size_t
28 #include <stddef.h>
29
30
31 #define GLOB_ERR (1 << 0)
32 #define GLOB_MARK (1 << 1)
33 #define GLOB_NOSORT (1 << 2)
34 #define GLOB_DOOFFS (1 << 3)
35 #define GLOB_NOCHECK (1 << 4)
36 #define GLOB_APPEND (1 << 5)
37 #define GLOB_NOESCAPE (1 << 6)
38 #define GLOB_PERIOD (1 << 7)
39
40 #if !defined __USE_POSIX2 || defined __USE_MISC
41 # define GLOB_MAGCHAR (1 << 8)
42 # define GLOB_ALTDIRFUNC (1 << 9)
43 # define GLOB_BRACE (1 << 10)
44 # define GLOB_NOMAGIC (1 << 11)
45 # define GLOB_TILDE (1 << 12)
46 # define GLOB_ONLYDIR (1 << 13)
47 # define GLOB_TILDE_CHECK (1 << 14)
48
49 # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS \
50 |GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND \
51 |GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE \
52 |GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK)
53 #else
54 # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS \
55 |GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND \
56 |GLOB_PERIOD)
57 #endif
58
59
60 #define GLOB_NOSPACE 1
61 #define GLOB_ABORTED 2
62 #define GLOB_NOMATCH 3
63 #define GLOB_NOSYS 4
64 #ifdef __USE_GNU
65
66
67 # define GLOB_ABEND GLOB_ABORTED
68 #endif
69
70
71 #ifdef __USE_GNU
72 struct stat;
73 #endif
74 typedef struct
75 {
76 size_t gl_pathc;
77 char **gl_pathv;
78 size_t gl_offs;
79 int gl_flags;
80
81
82
83 void (*gl_closedir) (void *);
84 #ifdef __USE_GNU
85 struct dirent *(*gl_readdir) (void *);
86 #else
87 void *(*gl_readdir) (void *);
88 #endif
89 void *(*gl_opendir) (const char *);
90 #ifdef __USE_GNU
91 int (*gl_lstat) (const char *__restrict, struct stat *__restrict);
92 int (*gl_stat) (const char *__restrict, struct stat *__restrict);
93 #else
94 int (*gl_lstat) (const char *__restrict, void *__restrict);
95 int (*gl_stat) (const char *__restrict, void *__restrict);
96 #endif
97 } glob_t;
98
99 #ifdef __USE_LARGEFILE64
100 # ifdef __USE_GNU
101 struct stat64;
102 # endif
103 typedef struct
104 {
105 size_t gl_pathc;
106 char **gl_pathv;
107 size_t gl_offs;
108 int gl_flags;
109
110
111
112 void (*gl_closedir) (void *);
113 # ifdef __USE_GNU
114 struct dirent64 *(*gl_readdir) (void *);
115 # else
116 void *(*gl_readdir) (void *);
117 # endif
118 void *(*gl_opendir) (const char *);
119 # ifdef __USE_GNU
120 int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict);
121 int (*gl_stat) (const char *__restrict, struct stat64 *__restrict);
122 # else
123 int (*gl_lstat) (const char *__restrict, void *__restrict);
124 int (*gl_stat) (const char *__restrict, void *__restrict);
125 # endif
126 } glob64_t;
127 #endif
128
129
130
131
132
133
134
135
136
137 #if !defined __USE_FILE_OFFSET64 || defined __GLOB_GNULIB
138 extern int glob (const char *__restrict __pattern, int __flags,
139 int (*__errfunc) (const char *, int),
140 glob_t *__restrict __pglob) __THROWNL;
141
142
143 extern void globfree (glob_t *__pglob) __THROW;
144 #else
145 # ifdef __USE_TIME_BITS64
146 extern int __REDIRECT_NTHNL (glob, (const char *__restrict __pattern,
147 int __flags,
148 int (*__errfunc) (const char *, int),
149 glob_t *__restrict __pglob),
150 __glob64_time64);
151
152 extern void __REDIRECT_NTH (globfree, (glob_t *__pglob),
153 __globfree64_time64);
154 # else
155 extern int __REDIRECT_NTHNL (glob, (const char *__restrict __pattern,
156 int __flags,
157 int (*__errfunc) (const char *, int),
158 glob_t *__restrict __pglob), glob64);
159
160 extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
161 # endif
162 #endif
163
164 #ifdef __USE_LARGEFILE64
165 # ifdef __USE_TIME_BITS64
166 extern int __REDIRECT_NTHNL (glob64, (const char *__restrict __pattern,
167 int __flags,
168 int (*__errfunc) (const char *, int),
169 glob64_t *__restrict __pglob),
170 __glob64_time64);
171
172 extern void __REDIRECT_NTH (globfree64, (glob64_t *__pglob),
173 __globfree64_time64);
174 # else
175 extern int glob64 (const char *__restrict __pattern, int __flags,
176 int (*__errfunc) (const char *, int),
177 glob64_t *__restrict __pglob) __THROWNL;
178
179 extern void globfree64 (glob64_t *__pglob) __THROW;
180 # endif
181 #endif
182
183
184 #ifdef __USE_GNU
185
186
187
188
189
190 extern int glob_pattern_p (const char *__pattern, int __quote) __THROW;
191 #endif
192
193 __END_DECLS
194
195 #endif