Commit | Line | Data |
---|---|---|
68a121a5 | 1 | /* |
56559b70 KB |
2 | * Copyright (c) 1989, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
68a121a5 KB |
4 | * |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * Guido van Rossum. | |
7 | * | |
863005e5 | 8 | * %sccs.include.redist.c% |
68a121a5 | 9 | * |
56559b70 | 10 | * @(#)glob.h 8.1 (Berkeley) %G% |
68a121a5 KB |
11 | */ |
12 | ||
d2b7358e KB |
13 | #ifndef _GLOB_H_ |
14 | #define _GLOB_H_ | |
15 | ||
8c6924cb KB |
16 | #include <sys/cdefs.h> |
17 | ||
18 | struct stat; | |
68a121a5 | 19 | typedef struct { |
8c6924cb KB |
20 | int gl_pathc; /* Count of total paths so far. */ |
21 | int gl_matchc; /* Count of paths matching pattern. */ | |
22 | int gl_offs; /* Reserved at beginning of gl_pathv. */ | |
23 | int gl_flags; /* Copy of flags parameter to glob. */ | |
24 | char **gl_pathv; /* List of paths matching pattern. */ | |
25 | /* Copy of errfunc parameter to glob. */ | |
26 | int (*gl_errfunc) __P((const char *, int)); | |
27 | ||
28 | /* | |
29 | * Alternate filesystem access methods for glob; replacement | |
30 | * versions of closedir(3), readdir(3), opendir(3), stat(2) | |
31 | * and lstat(2). | |
32 | */ | |
33 | void (*gl_closedir) __P((void *)); | |
34 | struct dirent *(*gl_readdir) __P((void *)); | |
35 | void *(*gl_opendir) __P((const char *)); | |
36 | int (*gl_lstat) __P((const char *, struct stat *)); | |
37 | int (*gl_stat) __P((const char *, struct stat *)); | |
68a121a5 KB |
38 | } glob_t; |
39 | ||
8c6924cb KB |
40 | #define GLOB_APPEND 0x0001 /* Append to output from previous call. */ |
41 | #define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ | |
42 | #define GLOB_ERR 0x0004 /* Return on error. */ | |
43 | #define GLOB_MARK 0x0008 /* Append / to matching directories. */ | |
44 | #define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */ | |
45 | #define GLOB_NOSORT 0x0020 /* Don't sort. */ | |
a5ba4a08 | 46 | |
68a121a5 | 47 | #ifndef _POSIX_SOURCE |
8c6924cb KB |
48 | #define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ |
49 | #define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ | |
50 | #define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ | |
51 | #define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ | |
52 | #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ | |
53 | #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ | |
68a121a5 KB |
54 | #endif |
55 | ||
8c6924cb KB |
56 | #define GLOB_NOSPACE (-1) /* Malloc call failed. */ |
57 | #define GLOB_ABEND (-2) /* Unignored error. */ | |
993000f1 DS |
58 | |
59 | __BEGIN_DECLS | |
8c6924cb | 60 | int glob __P((const char *, int, int (*)(const char *, int), glob_t *)); |
a5ba4a08 | 61 | void globfree __P((glob_t *)); |
993000f1 | 62 | __END_DECLS |
d2b7358e KB |
63 | |
64 | #endif /* !_GLOB_H_ */ |