143003dfeSmillert /* 243003dfeSmillert * Copyright (c) 1989, 1993 343003dfeSmillert * The Regents of the University of California. All rights reserved. 443003dfeSmillert * 543003dfeSmillert * This code is derived from software contributed to Berkeley by 643003dfeSmillert * Guido van Rossum. 743003dfeSmillert * 843003dfeSmillert * Redistribution and use in source and binary forms, with or without 943003dfeSmillert * modification, are permitted provided that the following conditions 1043003dfeSmillert * are met: 1143003dfeSmillert * 1. Redistributions of source code must retain the above copyright 1243003dfeSmillert * notice, this list of conditions and the following disclaimer. 1343003dfeSmillert * 2. Redistributions in binary form must reproduce the above copyright 1443003dfeSmillert * notice, this list of conditions and the following disclaimer in the 1543003dfeSmillert * documentation and/or other materials provided with the distribution. 1643003dfeSmillert * 3. Neither the name of the University nor the names of its contributors 1743003dfeSmillert * may be used to endorse or promote products derived from this software 1843003dfeSmillert * without specific prior written permission. 1943003dfeSmillert * 20*898184e3Ssthen * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND 2143003dfeSmillert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2243003dfeSmillert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2343003dfeSmillert * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2443003dfeSmillert * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2543003dfeSmillert * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2643003dfeSmillert * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2743003dfeSmillert * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2843003dfeSmillert * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2943003dfeSmillert * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3043003dfeSmillert * SUCH DAMAGE. 3143003dfeSmillert * 3243003dfeSmillert * @(#)glob.h 8.1 (Berkeley) 6/2/93 3343003dfeSmillert * [lots of perl-specific changes since then--see bsd_glob.c] 3443003dfeSmillert */ 3543003dfeSmillert 3643003dfeSmillert #ifndef _BSD_GLOB_H_ 3743003dfeSmillert #define _BSD_GLOB_H_ 3843003dfeSmillert 3943003dfeSmillert /* #include <sys/cdefs.h> */ 4043003dfeSmillert 4143003dfeSmillert typedef struct { 4243003dfeSmillert int gl_pathc; /* Count of total paths so far. */ 4343003dfeSmillert int gl_matchc; /* Count of paths matching pattern. */ 4443003dfeSmillert int gl_offs; /* Reserved at beginning of gl_pathv. */ 4543003dfeSmillert int gl_flags; /* Copy of flags parameter to glob. */ 4643003dfeSmillert char **gl_pathv; /* List of paths matching pattern. */ 4743003dfeSmillert /* Copy of errfunc parameter to glob. */ 4843003dfeSmillert int (*gl_errfunc)(const char *, int); 4943003dfeSmillert 5043003dfeSmillert /* 5143003dfeSmillert * Alternate filesystem access methods for glob; replacement 5243003dfeSmillert * versions of closedir(3), readdir(3), opendir(3), stat(2) 5343003dfeSmillert * and lstat(2). 5443003dfeSmillert */ 5543003dfeSmillert void (*gl_closedir)(void *); 5643003dfeSmillert Direntry_t *(*gl_readdir)(void *); 5743003dfeSmillert void *(*gl_opendir)(const char *); 5843003dfeSmillert int (*gl_lstat)(const char *, Stat_t *); 5943003dfeSmillert int (*gl_stat)(const char *, Stat_t *); 6043003dfeSmillert } glob_t; 6143003dfeSmillert 6243003dfeSmillert #define GLOB_APPEND 0x0001 /* Append to output from previous call. */ 6343003dfeSmillert #define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ 6443003dfeSmillert #define GLOB_ERR 0x0004 /* Return on error. */ 6543003dfeSmillert #define GLOB_MARK 0x0008 /* Append / to matching directories. */ 6643003dfeSmillert #define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */ 6743003dfeSmillert #define GLOB_NOSORT 0x0020 /* Don't sort. */ 6843003dfeSmillert 6943003dfeSmillert #define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ 7043003dfeSmillert #define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ 7143003dfeSmillert #define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ 7243003dfeSmillert #define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ 7343003dfeSmillert #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ 7443003dfeSmillert #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ 7543003dfeSmillert #define GLOB_NOCASE 0x1000 /* Treat filenames without regard for case. */ 7643003dfeSmillert #define GLOB_ALPHASORT 0x2000 /* Alphabetic, not ASCII sort, like csh. */ 7743003dfeSmillert #define GLOB_LIMIT 0x4000 /* Limit pattern match output to ARG_MAX 7843003dfeSmillert (usually from limits.h). */ 7943003dfeSmillert 8043003dfeSmillert #define GLOB_NOSPACE (-1) /* Malloc call failed. */ 8143003dfeSmillert #define GLOB_ABEND (-2) /* Unignored error. */ 8243003dfeSmillert 8343003dfeSmillert int bsd_glob(const char *, int, int (*)(const char *, int), glob_t *); 8443003dfeSmillert void bsd_globfree(glob_t *); 8543003dfeSmillert 8643003dfeSmillert #endif /* !_BSD_GLOB_H_ */ 87