1354195Sbrooks/* NetBSD: glob.h,v 1.13 2001/03/16 21:02:42 christos Exp */ 283098Smp 359243Sobrien/* 483098Smp * Copyright (c) 1989, 1993 583098Smp * The Regents of the University of California. All rights reserved. 659243Sobrien * 759243Sobrien * This code is derived from software contributed to Berkeley by 859243Sobrien * Guido van Rossum. 959243Sobrien * 1059243Sobrien * Redistribution and use in source and binary forms, with or without 1159243Sobrien * modification, are permitted provided that the following conditions 1259243Sobrien * are met: 1359243Sobrien * 1. Redistributions of source code must retain the above copyright 1459243Sobrien * notice, this list of conditions and the following disclaimer. 1559243Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1659243Sobrien * notice, this list of conditions and the following disclaimer in the 1759243Sobrien * documentation and/or other materials provided with the distribution. 18100616Smp * 3. Neither the name of the University nor the names of its contributors 1959243Sobrien * may be used to endorse or promote products derived from this software 2059243Sobrien * without specific prior written permission. 2159243Sobrien * 2259243Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2359243Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2459243Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2559243Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2659243Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2759243Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2859243Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2959243Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3059243Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3159243Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3259243Sobrien * SUCH DAMAGE. 3359243Sobrien * 3483098Smp * @(#)glob.h 8.1 (Berkeley) 6/2/93 3559243Sobrien */ 3659243Sobrien 3759243Sobrien#ifndef _GLOB_H_ 3859243Sobrien#define _GLOB_H_ 3959243Sobrien 4059243Sobrientypedef struct { 4183098Smp int gl_pathc; /* Count of total paths so far. */ 4283098Smp int gl_matchc; /* Count of paths matching pattern. */ 4383098Smp int gl_offs; /* Reserved at beginning of gl_pathv. */ 4483098Smp int gl_flags; /* Copy of flags parameter to glob. */ 4583098Smp char **gl_pathv; /* List of paths matching pattern. */ 4683098Smp /* Copy of errfunc parameter to glob. */ 47167465Smp int (*gl_errfunc) (const char *, int); 4883098Smp 4983098Smp /* 5083098Smp * Alternate filesystem access methods for glob; replacement 5183098Smp * versions of closedir(3), readdir(3), opendir(3), stat(2) 5283098Smp * and lstat(2). 5383098Smp */ 54167465Smp void (*gl_closedir) (void *); 55167465Smp struct dirent *(*gl_readdir) (void *); 56167465Smp void *(*gl_opendir) (const char *); 57167465Smp int (*gl_lstat) (const char *, struct stat *); 58167465Smp int (*gl_stat) (const char *, struct stat *); 5959243Sobrien} glob_t; 6059243Sobrien 6183098Smp#define GLOB_APPEND 0x0001 /* Append to output from previous call. */ 6283098Smp#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ 6383098Smp#define GLOB_ERR 0x0004 /* Return on error. */ 6483098Smp#define GLOB_MARK 0x0008 /* Append / to matching directories. */ 6583098Smp#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */ 6683098Smp#define GLOB_NOSORT 0x0020 /* Don't sort. */ 6783098Smp#define GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */ 6859243Sobrien 6983098Smp#define GLOB_NOSPACE (-1) /* Malloc call failed. */ 7083098Smp#define GLOB_ABORTED (-2) /* Unignored error. */ 7183098Smp#define GLOB_NOMATCH (-3) /* No match, and GLOB_NOCHECK was not set. */ 7283098Smp#define GLOB_NOSYS (-4) /* Implementation does not support function. */ 7359243Sobrien 74100616Smp/* #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) */ 7583098Smp#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ 7683098Smp#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ 7783098Smp#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ 7883098Smp#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ 7983098Smp#define GLOB_LIMIT 0x0400 /* Limit memory used by matches to ARG_MAX */ 8083098Smp#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ 8183098Smp#define GLOB_ALTNOT 0x1000 /* use alternate glob character [^ not !] */ 8283098Smp#define GLOB_QUOTE 0x2000 /* XXX: source compatibility */ 83231990Smp#define GLOB_STAR 0x4000 /* use glob ** to recurse directories */ 84231990Smp#define GLOB_DOT 0x8000 /* don't skip dotfiles (except . and ..) */ 8559243Sobrien 8683098Smp#define GLOB_ABEND GLOB_ABORTED /* source compatibility */ 87100616Smp/* #endif */ 8883098Smp 89167465Smpint glob (const char *, int, int (*)(const char *, int), glob_t *); 90167465Smpvoid globfree (glob_t *); 91167465Smpint globcharcoll (Char, Char, int); 92145479Smp 9359243Sobrien#endif /* !_GLOB_H_ */ 94