172445Sassar/*
272445Sassar * Copyright (c) 1989, 1993
372445Sassar *	The Regents of the University of California.  All rights reserved.
472445Sassar *
572445Sassar * This code is derived from software contributed to Berkeley by
672445Sassar * Guido van Rossum.
772445Sassar *
872445Sassar * Redistribution and use in source and binary forms, with or without
972445Sassar * modification, are permitted provided that the following conditions
1072445Sassar * are met:
1172445Sassar * 1. Redistributions of source code must retain the above copyright
1272445Sassar *    notice, this list of conditions and the following disclaimer.
1372445Sassar * 2. Redistributions in binary form must reproduce the above copyright
1472445Sassar *    notice, this list of conditions and the following disclaimer in the
1572445Sassar *    documentation and/or other materials provided with the distribution.
16178825Sdfr * 3. Neither the name of the University nor the names of its contributors
1772445Sassar *    may be used to endorse or promote products derived from this software
1872445Sassar *    without specific prior written permission.
1972445Sassar *
2072445Sassar * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2172445Sassar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2272445Sassar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2372445Sassar * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2472445Sassar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2572445Sassar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2672445Sassar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2772445Sassar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2872445Sassar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2972445Sassar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3072445Sassar * SUCH DAMAGE.
3172445Sassar *
3272445Sassar *	@(#)glob.h	8.1 (Berkeley) 6/2/93
3372445Sassar */
3472445Sassar
3572445Sassar#ifndef _GLOB_H_
3672445Sassar#define	_GLOB_H_
3772445Sassar
38178825Sdfr#ifndef ROKEN_LIB_FUNCTION
39178825Sdfr#ifdef _WIN32
40233294Sstas#define ROKEN_LIB_FUNCTION
41233294Sstas#define ROKEN_LIB_CALL _stdcall
42178825Sdfr#else
43178825Sdfr#define ROKEN_LIB_FUNCTION
44233294Sstas#define ROKEN_LIB_CALL
45178825Sdfr#endif
46178825Sdfr#endif
47178825Sdfr
48178825Sdfr#ifdef __cplusplus
49178825Sdfrextern "C" {
50178825Sdfr#endif
51178825Sdfr
52178825Sdfr#define glob_t rk_glob_t
53178825Sdfr#define	glob rk_glob
54178825Sdfr#define	globfree rk_globfree
55178825Sdfr
5672445Sassarstruct stat;
5772445Sassartypedef struct {
5872445Sassar	int gl_pathc;		/* Count of total paths so far. */
5972445Sassar	int gl_matchc;		/* Count of paths matching pattern. */
6072445Sassar	int gl_offs;		/* Reserved at beginning of gl_pathv. */
6172445Sassar	int gl_flags;		/* Copy of flags parameter to glob. */
6272445Sassar	char **gl_pathv;	/* List of paths matching pattern. */
6372445Sassar				/* Copy of errfunc parameter to glob. */
6472445Sassar	int (*gl_errfunc) (const char *, int);
6572445Sassar
6672445Sassar	/*
6772445Sassar	 * Alternate filesystem access methods for glob; replacement
6872445Sassar	 * versions of closedir(3), readdir(3), opendir(3), stat(2)
6972445Sassar	 * and lstat(2).
7072445Sassar	 */
7172445Sassar	void (*gl_closedir) (void *);
7272445Sassar	struct dirent *(*gl_readdir) (void *);	
7372445Sassar	void *(*gl_opendir) (const char *);
7472445Sassar	int (*gl_lstat) (const char *, struct stat *);
7572445Sassar	int (*gl_stat) (const char *, struct stat *);
7672445Sassar} glob_t;
7772445Sassar
7872445Sassar#define	GLOB_APPEND	0x0001	/* Append to output from previous call. */
7972445Sassar#define	GLOB_DOOFFS	0x0002	/* Use gl_offs. */
8072445Sassar#define	GLOB_ERR	0x0004	/* Return on error. */
8172445Sassar#define	GLOB_MARK	0x0008	/* Append / to matching directories. */
8272445Sassar#define	GLOB_NOCHECK	0x0010	/* Return pattern itself if nothing matches. */
8372445Sassar#define	GLOB_NOSORT	0x0020	/* Don't sort. */
8472445Sassar
8572445Sassar#define	GLOB_ALTDIRFUNC	0x0040	/* Use alternately specified directory funcs. */
8672445Sassar#define	GLOB_BRACE	0x0080	/* Expand braces ala csh. */
8772445Sassar#define	GLOB_MAGCHAR	0x0100	/* Pattern had globbing characters. */
8872445Sassar#define	GLOB_NOMAGIC	0x0200	/* GLOB_NOCHECK without magic chars (csh). */
8972445Sassar#define	GLOB_QUOTE	0x0400	/* Quote special chars with \. */
9072445Sassar#define	GLOB_TILDE	0x0800	/* Expand tilde names from the passwd file. */
9178527Sassar#define GLOB_LIMIT	0x1000	/* Limit memory used by matches to ARG_MAX */
9272445Sassar
9372445Sassar#define	GLOB_NOSPACE	(-1)	/* Malloc call failed. */
9472445Sassar#define	GLOB_ABEND	(-2)	/* Unignored error. */
9572445Sassar
96178825Sdfrint ROKEN_LIB_FUNCTION
97178825Sdfrglob (const char *, int, int (*)(const char *, int), glob_t *);
9872445Sassar
99178825Sdfrvoid ROKEN_LIB_FUNCTION
100178825Sdfrglobfree (glob_t *);
101178825Sdfr
102178825Sdfr#ifdef __cplusplus
103178825Sdfr}
104178825Sdfr#endif
105178825Sdfr
10672445Sassar#endif /* !_GLOB_H_ */
107