00001 // glob.h 00002 // 00003 // © Portions copyright (c) 2006 Symbian Software Ltd. All rights reserved. 00004 // 00005 00006 /* 00007 * Copyright (c) 1989, 1993 00008 * The Regents of the University of California. All rights reserved. 00009 * 00010 * This code is derived from software contributed to Berkeley by 00011 * Guido van Rossum. 00012 * 00013 * Redistribution and use in source and binary forms, with or without 00014 * modification, are permitted provided that the following conditions 00015 * are met: 00016 * 1. Redistributions of source code must retain the above copyright 00017 * notice, this list of conditions and the following disclaimer. 00018 * 2. Redistributions in binary form must reproduce the above copyright 00019 * notice, this list of conditions and the following disclaimer in the 00020 * documentation and/or other materials provided with the distribution. 00021 * 3. All advertising materials mentioning features or use of this software 00022 * must display the following acknowledgement: 00023 * This product includes software developed by the University of 00024 * California, Berkeley and its contributors. 00025 * 4. Neither the name of the University nor the names of its contributors 00026 * may be used to endorse or promote products derived from this software 00027 * without specific prior written permission. 00028 * 00029 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00030 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00031 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00032 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00033 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00034 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00035 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00036 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00037 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00038 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00039 * SUCH DAMAGE. 00040 * 00041 * @(#)glob.h 8.1 (Berkeley) 6/2/93 00042 * $FreeBSD: src/include/glob.h,v 1.7 2002/07/17 04:58:09 mikeh Exp $ 00043 */ 00044 00045 #ifndef _GLOB_H_ 00046 #define _GLOB_H_ 00047 00048 #include <sys/cdefs.h> 00049 00050 struct stat; 00051 typedef struct { 00052 int gl_pathc; /* Count of total paths so far. */ 00053 int gl_matchc; /* Count of paths matching pattern. */ 00054 int gl_offs; /* Reserved at beginning of gl_pathv. */ 00055 int gl_flags; /* Copy of flags parameter to glob. */ 00056 char **gl_pathv; /* List of paths matching pattern. */ 00057 /* Copy of errfunc parameter to glob. */ 00058 int (*gl_errfunc)(const char *, int); 00059 00060 /* 00061 * Alternate filesystem access methods for glob; replacement 00062 * versions of closedir(3), readdir(3), opendir(3), stat(2) 00063 * and lstat(2). 00064 */ 00065 void (*gl_closedir)(void *); 00066 struct dirent *(*gl_readdir)(void *); 00067 void *(*gl_opendir)(const char *); 00068 int (*gl_lstat)(const char *, struct stat *); 00069 int (*gl_stat)(const char *, struct stat *); 00070 } glob_t; 00071 00072 #if __POSIX_VISIBLE >= 199209 00073 /* Believed to have been introduced in 1003.2-1992 */ 00074 #define GLOB_APPEND 0x0001 /* Append to output from previous call. */ 00075 #define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ 00076 #define GLOB_ERR 0x0004 /* Return on error. */ 00077 #define GLOB_MARK 0x0008 /* Append / to matching directories. */ 00078 #define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */ 00079 #define GLOB_NOSORT 0x0020 /* Don't sort. */ 00080 #define GLOB_NOESCAPE 0x2000 /* Disable backslash escaping. */ 00081 00082 /* Error values returned by glob(3) */ 00083 #define GLOB_NOSPACE (-1) /* Malloc call failed. */ 00084 #define GLOB_ABORTED (-2) /* Unignored error. */ 00085 #define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK was not set. */ 00086 #define GLOB_NOSYS (-4) /* Obsolete: source comptability only. */ 00087 #endif /* __POSIX_VISIBLE >= 199209 */ 00088 00089 #if __BSD_VISIBLE 00090 #define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ 00091 #define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ 00092 #define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ 00093 #define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ 00094 #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ 00095 #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ 00096 #define GLOB_LIMIT 0x1000 /* limit number of returned paths */ 00097 00098 /* source compatibility, these are the old names */ 00099 #define GLOB_MAXPATH GLOB_LIMIT 00100 #define GLOB_ABEND GLOB_ABORTED 00101 #endif /* __BSD_VISIBLE */ 00102 00103 __BEGIN_DECLS 00104 00105 IMPORT_C int glob(const char *, int, int (*)(const char *, int), glob_t *); 00106 IMPORT_C void globfree(glob_t *); 00107 00108 __END_DECLS 00109 00110 #endif /* !_GLOB_H_ */