1 /* 2 * Copyright (c) 1989 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Guido van Rossum. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)glob.h 5.9 (Berkeley) 02/10/93 11 */ 12 13 #ifndef _GLOB_H_ 14 #define _GLOB_H_ 15 16 #include <sys/cdefs.h> 17 18 struct stat; 19 typedef struct { 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 *)); 38 } glob_t; 39 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. */ 46 47 #ifndef _POSIX_SOURCE 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. */ 54 #endif 55 56 #define GLOB_NOSPACE (-1) /* Malloc call failed. */ 57 #define GLOB_ABEND (-2) /* Unignored error. */ 58 59 __BEGIN_DECLS 60 int glob __P((const char *, int, int (*)(const char *, int), glob_t *)); 61 void globfree __P((glob_t *)); 62 __END_DECLS 63 64 #endif /* !_GLOB_H_ */ 65