Back to index

php5  5.3.10
glob.h
Go to the documentation of this file.
00001 /*      $Id: glob.h 272473 2009-01-01 12:32:49Z pajoye $ */
00002 /*     OpenBSD: glob.h,v 1.7 2002/02/17 19:42:21 millert Exp   */
00003 /*     NetBSD: glob.h,v 1.5 1994/10/26 00:55:56 cgd Exp        */
00004 
00005 /*
00006  * Copyright (c) 1989, 1993
00007  *     The Regents of the University of California.  All rights reserved.
00008  *
00009  * This code is derived from software contributed to Berkeley by
00010  * Guido van Rossum.
00011  *
00012  * Redistribution and use in source and binary forms, with or without
00013  * modification, are permitted provided that the following conditions
00014  * are met:
00015  * 1. Redistributions of source code must retain the above copyright
00016  *    notice, this list of conditions and the following disclaimer.
00017  * 2. Redistributions in binary form must reproduce the above copyright
00018  *    notice, this list of conditions and the following disclaimer in the
00019  *    documentation and/or other materials provided with the distribution.
00020  * 3. All advertising materials mentioning features or use of this software
00021  *    must display the following acknowledgement:
00022  *     This product includes software developed by the University of
00023  *     California, Berkeley and its contributors.
00024  * 4. Neither the name of the University nor the names of its contributors
00025  *    may be used to endorse or promote products derived from this software
00026  *    without specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00029  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00032  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00034  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00035  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00036  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00037  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00038  * SUCH DAMAGE.
00039  *
00040  *     @(#)glob.h    8.1 (Berkeley) 6/2/93
00041  */
00042 
00043 #ifndef _GLOB_H_
00044 #define       _GLOB_H_
00045 
00046 #ifndef PHP_WIN32
00047 # include <sys/cdefs.h>
00048 #endif
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 /* Flags */
00073 #define       GLOB_APPEND   0x0001 /* Append to output from previous call. */
00074 #define       GLOB_DOOFFS   0x0002 /* Use gl_offs. */
00075 #define       GLOB_ERR      0x0004 /* Return on error. */
00076 #define       GLOB_MARK     0x0008 /* Append / to matching directories. */
00077 #define       GLOB_NOCHECK  0x0010 /* Return pattern itself if nothing matches. */
00078 #define       GLOB_NOSORT   0x0020 /* Don't sort. */
00079 
00080 #ifndef _POSIX_SOURCE
00081 #define       GLOB_ALTDIRFUNC      0x0040 /* Use alternately specified directory funcs. */
00082 #define       GLOB_BRACE    0x0080 /* Expand braces ala csh. */
00083 #define       GLOB_MAGCHAR  0x0100 /* Pattern had globbing characters. */
00084 #define       GLOB_NOMAGIC  0x0200 /* GLOB_NOCHECK without magic chars (csh). */
00085 #define       GLOB_QUOTE    0x0400 /* Quote special chars with \. */
00086 #define       GLOB_TILDE    0x0800 /* Expand tilde names from the passwd file. */
00087 #define       GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */
00088 #define GLOB_LIMIT   0x2000 /* Limit pattern match output to ARG_MAX */
00089 #endif
00090 
00091 /* Error values returned by glob(3) */
00092 #define       GLOB_NOSPACE  (-1)   /* Malloc call failed. */
00093 #define       GLOB_ABORTED  (-2)   /* Unignored error. */
00094 #define       GLOB_NOMATCH  (-3)   /* No match and GLOB_NOCHECK not set. */
00095 #define       GLOB_NOSYS    (-4)   /* Function not supported. */
00096 #define GLOB_ABEND   GLOB_ABORTED
00097 
00098 BEGIN_EXTERN_C()
00099 PHPAPI int    glob(const char *, int, int (*)(const char *, int), glob_t *);
00100 PHPAPI void   globfree(glob_t *);
00101 END_EXTERN_C()
00102 #endif /* !_GLOB_H_ */