glob.h revision 59243
159243Sobrien/*
259243Sobrien * Copyright (c) 1989 The Regents of the University of California.
359243Sobrien * All rights reserved.
459243Sobrien *
559243Sobrien * This code is derived from software contributed to Berkeley by
659243Sobrien * Guido van Rossum.
759243Sobrien *
859243Sobrien * Redistribution and use in source and binary forms, with or without
959243Sobrien * modification, are permitted provided that the following conditions
1059243Sobrien * are met:
1159243Sobrien * 1. Redistributions of source code must retain the above copyright
1259243Sobrien *    notice, this list of conditions and the following disclaimer.
1359243Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1459243Sobrien *    notice, this list of conditions and the following disclaimer in the
1559243Sobrien *    documentation and/or other materials provided with the distribution.
1659243Sobrien * 3. All advertising materials mentioning features or use of this software
1759243Sobrien *    must display the following acknowledgement:
1859243Sobrien *	This product includes software developed by the University of
1959243Sobrien *	California, Berkeley and its contributors.
2059243Sobrien * 4. Neither the name of the University nor the names of its contributors
2159243Sobrien *    may be used to endorse or promote products derived from this software
2259243Sobrien *    without specific prior written permission.
2359243Sobrien *
2459243Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2559243Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2659243Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2759243Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2859243Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2959243Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3059243Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3159243Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3259243Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3359243Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3459243Sobrien * SUCH DAMAGE.
3559243Sobrien *
3659243Sobrien *	@(#)glob.h	5.6 (Berkeley) 4/3/91
3759243Sobrien */
3859243Sobrien
3959243Sobrien#ifndef _GLOB_H_
4059243Sobrien#define	_GLOB_H_
4159243Sobrien
4259243Sobrientypedef struct {
4359243Sobrien	int gl_pathc;		/* count of total paths so far */
4459243Sobrien	int gl_matchc;		/* count of paths matching pattern */
4559243Sobrien	int gl_offs;		/* reserved at beginning of gl_pathv */
4659243Sobrien	int gl_flags;		/* copy of flags parameter to glob() */
4759243Sobrien				/* copy of errfunc parameter to glob() */
4859243Sobrien	int (*gl_errfunc) __P((const char *, int));
4959243Sobrien	char **gl_pathv;	/* list of paths matching pattern */
5059243Sobrien} glob_t;
5159243Sobrien
5259243Sobrien#define	GLOB_APPEND	0x001	/* append to output from previous call */
5359243Sobrien#define	GLOB_DOOFFS	0x002	/* use gl_offs */
5459243Sobrien#define	GLOB_ERR	0x004	/* return on error */
5559243Sobrien#define	GLOB_MAGCHAR	0x008	/* pattern had globbing characters */
5659243Sobrien#define	GLOB_MARK	0x010	/* append / to matching directories */
5759243Sobrien#define	GLOB_NOCHECK	0x020	/* return pattern itself if nothing matches */
5859243Sobrien#define	GLOB_NOSORT	0x040	/* don't sort */
5959243Sobrien#define	GLOB_QUOTE	0x080	/* quote special chars with \ */
6059243Sobrien#define GLOB_NOMAGIC	0x100	/* like GLOB_NOCHECK but only if the pattern
6159243Sobrien				 * did not have any magic characters */
6259243Sobrien#define	GLOB_ALTNOT	0x200	/* use alternate glob character [^ not !] */
6359243Sobrien
6459243Sobrien#define	GLOB_NOSPACE	(-1)	/* malloc call failed */
6559243Sobrien#define	GLOB_ABEND	(-2)	/* unignored error */
6659243Sobrien
6759243Sobrienint glob __P((const char *, int, int (*)(const char *, int), glob_t *));
6859243Sobrienvoid globfree __P((glob_t *));
6959243Sobrienint globcharcoll __P((int, int));
7059243Sobrien
7159243Sobrien#endif /* !_GLOB_H_ */
72