glob.h revision 74469
11539Srgrimes/* 21539Srgrimes * Copyright (c) 1989, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * 51539Srgrimes * This code is derived from software contributed to Berkeley by 61539Srgrimes * Guido van Rossum. 71539Srgrimes * 81539Srgrimes * Redistribution and use in source and binary forms, with or without 91539Srgrimes * modification, are permitted provided that the following conditions 101539Srgrimes * are met: 111539Srgrimes * 1. Redistributions of source code must retain the above copyright 121539Srgrimes * notice, this list of conditions and the following disclaimer. 131539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141539Srgrimes * notice, this list of conditions and the following disclaimer in the 151539Srgrimes * documentation and/or other materials provided with the distribution. 161539Srgrimes * 3. All advertising materials mentioning features or use of this software 171539Srgrimes * must display the following acknowledgement: 181539Srgrimes * This product includes software developed by the University of 191539Srgrimes * California, Berkeley and its contributors. 201539Srgrimes * 4. Neither the name of the University nor the names of its contributors 211539Srgrimes * may be used to endorse or promote products derived from this software 221539Srgrimes * without specific prior written permission. 231539Srgrimes * 241539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341539Srgrimes * SUCH DAMAGE. 351539Srgrimes * 361539Srgrimes * @(#)glob.h 8.1 (Berkeley) 6/2/93 3774469Sjlemon * $FreeBSD: head/include/glob.h 74469 2001-03-19 19:10:06Z jlemon $ 381539Srgrimes */ 391539Srgrimes 401539Srgrimes#ifndef _GLOB_H_ 411539Srgrimes#define _GLOB_H_ 421539Srgrimes 431539Srgrimes#include <sys/cdefs.h> 441539Srgrimes 451539Srgrimesstruct stat; 461539Srgrimestypedef struct { 471539Srgrimes int gl_pathc; /* Count of total paths so far. */ 481539Srgrimes int gl_matchc; /* Count of paths matching pattern. */ 491539Srgrimes int gl_offs; /* Reserved at beginning of gl_pathv. */ 501539Srgrimes int gl_flags; /* Copy of flags parameter to glob. */ 511539Srgrimes char **gl_pathv; /* List of paths matching pattern. */ 521539Srgrimes /* Copy of errfunc parameter to glob. */ 531539Srgrimes int (*gl_errfunc) __P((const char *, int)); 541539Srgrimes 551539Srgrimes /* 561539Srgrimes * Alternate filesystem access methods for glob; replacement 571539Srgrimes * versions of closedir(3), readdir(3), opendir(3), stat(2) 581539Srgrimes * and lstat(2). 591539Srgrimes */ 601539Srgrimes void (*gl_closedir) __P((void *)); 618858Srgrimes struct dirent *(*gl_readdir) __P((void *)); 621539Srgrimes void *(*gl_opendir) __P((const char *)); 631539Srgrimes int (*gl_lstat) __P((const char *, struct stat *)); 641539Srgrimes int (*gl_stat) __P((const char *, struct stat *)); 651539Srgrimes} glob_t; 661539Srgrimes 671539Srgrimes#define GLOB_APPEND 0x0001 /* Append to output from previous call. */ 681539Srgrimes#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ 691539Srgrimes#define GLOB_ERR 0x0004 /* Return on error. */ 701539Srgrimes#define GLOB_MARK 0x0008 /* Append / to matching directories. */ 711539Srgrimes#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */ 721539Srgrimes#define GLOB_NOSORT 0x0020 /* Don't sort. */ 731539Srgrimes 741539Srgrimes#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ 751539Srgrimes#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ 761539Srgrimes#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ 771539Srgrimes#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ 781539Srgrimes#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ 791539Srgrimes#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ 8074469Sjlemon#define GLOB_MAXPATH 0x1000 /* limit number of returned paths */ 811539Srgrimes 821539Srgrimes#define GLOB_NOSPACE (-1) /* Malloc call failed. */ 831539Srgrimes#define GLOB_ABEND (-2) /* Unignored error. */ 8474469Sjlemon#define GLOB_LIMIT (-3) /* Path limit was hit. */ 851539Srgrimes 861539Srgrimes__BEGIN_DECLS 871539Srgrimesint glob __P((const char *, int, int (*)(const char *, int), glob_t *)); 881539Srgrimesvoid globfree __P((glob_t *)); 891539Srgrimes__END_DECLS 901539Srgrimes 911539Srgrimes#endif /* !_GLOB_H_ */ 92