xref: /freebsd/crypto/heimdal/lib/roken/glob.hin (revision 6a068746777241722b2b32c5d0bc443a2a64d80b)
15e9cd1aeSAssar Westerlund/*
25e9cd1aeSAssar Westerlund * Copyright (c) 1989, 1993
35e9cd1aeSAssar Westerlund *	The Regents of the University of California.  All rights reserved.
45e9cd1aeSAssar Westerlund *
55e9cd1aeSAssar Westerlund * This code is derived from software contributed to Berkeley by
65e9cd1aeSAssar Westerlund * Guido van Rossum.
75e9cd1aeSAssar Westerlund *
85e9cd1aeSAssar Westerlund * Redistribution and use in source and binary forms, with or without
95e9cd1aeSAssar Westerlund * modification, are permitted provided that the following conditions
105e9cd1aeSAssar Westerlund * are met:
115e9cd1aeSAssar Westerlund * 1. Redistributions of source code must retain the above copyright
125e9cd1aeSAssar Westerlund *    notice, this list of conditions and the following disclaimer.
135e9cd1aeSAssar Westerlund * 2. Redistributions in binary form must reproduce the above copyright
145e9cd1aeSAssar Westerlund *    notice, this list of conditions and the following disclaimer in the
155e9cd1aeSAssar Westerlund *    documentation and/or other materials provided with the distribution.
16c19800e8SDoug Rabson * 3. Neither the name of the University nor the names of its contributors
175e9cd1aeSAssar Westerlund *    may be used to endorse or promote products derived from this software
185e9cd1aeSAssar Westerlund *    without specific prior written permission.
195e9cd1aeSAssar Westerlund *
205e9cd1aeSAssar Westerlund * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
215e9cd1aeSAssar Westerlund * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
225e9cd1aeSAssar Westerlund * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
235e9cd1aeSAssar Westerlund * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
245e9cd1aeSAssar Westerlund * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
255e9cd1aeSAssar Westerlund * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
265e9cd1aeSAssar Westerlund * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
275e9cd1aeSAssar Westerlund * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
285e9cd1aeSAssar Westerlund * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
295e9cd1aeSAssar Westerlund * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
305e9cd1aeSAssar Westerlund * SUCH DAMAGE.
315e9cd1aeSAssar Westerlund *
325e9cd1aeSAssar Westerlund *	@(#)glob.h	8.1 (Berkeley) 6/2/93
335e9cd1aeSAssar Westerlund */
345e9cd1aeSAssar Westerlund
355e9cd1aeSAssar Westerlund#ifndef _GLOB_H_
365e9cd1aeSAssar Westerlund#define	_GLOB_H_
375e9cd1aeSAssar Westerlund
38c19800e8SDoug Rabson#ifndef ROKEN_LIB_FUNCTION
39c19800e8SDoug Rabson#ifdef _WIN32
40*ae771770SStanislav Sedov#define ROKEN_LIB_FUNCTION
41*ae771770SStanislav Sedov#define ROKEN_LIB_CALL _stdcall
42c19800e8SDoug Rabson#else
43c19800e8SDoug Rabson#define ROKEN_LIB_FUNCTION
44*ae771770SStanislav Sedov#define ROKEN_LIB_CALL
45c19800e8SDoug Rabson#endif
46c19800e8SDoug Rabson#endif
47c19800e8SDoug Rabson
48c19800e8SDoug Rabson#ifdef __cplusplus
49c19800e8SDoug Rabsonextern "C" {
50c19800e8SDoug Rabson#endif
51c19800e8SDoug Rabson
52c19800e8SDoug Rabson#define glob_t rk_glob_t
53c19800e8SDoug Rabson#define	glob rk_glob
54c19800e8SDoug Rabson#define	globfree rk_globfree
55c19800e8SDoug Rabson
565e9cd1aeSAssar Westerlundstruct stat;
575e9cd1aeSAssar Westerlundtypedef struct {
585e9cd1aeSAssar Westerlund	int gl_pathc;		/* Count of total paths so far. */
595e9cd1aeSAssar Westerlund	int gl_matchc;		/* Count of paths matching pattern. */
605e9cd1aeSAssar Westerlund	int gl_offs;		/* Reserved at beginning of gl_pathv. */
615e9cd1aeSAssar Westerlund	int gl_flags;		/* Copy of flags parameter to glob. */
625e9cd1aeSAssar Westerlund	char **gl_pathv;	/* List of paths matching pattern. */
635e9cd1aeSAssar Westerlund				/* Copy of errfunc parameter to glob. */
645e9cd1aeSAssar Westerlund	int (*gl_errfunc) (const char *, int);
655e9cd1aeSAssar Westerlund
665e9cd1aeSAssar Westerlund	/*
675e9cd1aeSAssar Westerlund	 * Alternate filesystem access methods for glob; replacement
685e9cd1aeSAssar Westerlund	 * versions of closedir(3), readdir(3), opendir(3), stat(2)
695e9cd1aeSAssar Westerlund	 * and lstat(2).
705e9cd1aeSAssar Westerlund	 */
715e9cd1aeSAssar Westerlund	void (*gl_closedir) (void *);
725e9cd1aeSAssar Westerlund	struct dirent *(*gl_readdir) (void *);
735e9cd1aeSAssar Westerlund	void *(*gl_opendir) (const char *);
745e9cd1aeSAssar Westerlund	int (*gl_lstat) (const char *, struct stat *);
755e9cd1aeSAssar Westerlund	int (*gl_stat) (const char *, struct stat *);
765e9cd1aeSAssar Westerlund} glob_t;
775e9cd1aeSAssar Westerlund
785e9cd1aeSAssar Westerlund#define	GLOB_APPEND	0x0001	/* Append to output from previous call. */
795e9cd1aeSAssar Westerlund#define	GLOB_DOOFFS	0x0002	/* Use gl_offs. */
805e9cd1aeSAssar Westerlund#define	GLOB_ERR	0x0004	/* Return on error. */
815e9cd1aeSAssar Westerlund#define	GLOB_MARK	0x0008	/* Append / to matching directories. */
825e9cd1aeSAssar Westerlund#define	GLOB_NOCHECK	0x0010	/* Return pattern itself if nothing matches. */
835e9cd1aeSAssar Westerlund#define	GLOB_NOSORT	0x0020	/* Don't sort. */
845e9cd1aeSAssar Westerlund
855e9cd1aeSAssar Westerlund#define	GLOB_ALTDIRFUNC	0x0040	/* Use alternately specified directory funcs. */
865e9cd1aeSAssar Westerlund#define	GLOB_BRACE	0x0080	/* Expand braces ala csh. */
875e9cd1aeSAssar Westerlund#define	GLOB_MAGCHAR	0x0100	/* Pattern had globbing characters. */
885e9cd1aeSAssar Westerlund#define	GLOB_NOMAGIC	0x0200	/* GLOB_NOCHECK without magic chars (csh). */
895e9cd1aeSAssar Westerlund#define	GLOB_QUOTE	0x0400	/* Quote special chars with \. */
905e9cd1aeSAssar Westerlund#define	GLOB_TILDE	0x0800	/* Expand tilde names from the passwd file. */
91adb0ddaeSAssar Westerlund#define GLOB_LIMIT	0x1000	/* Limit memory used by matches to ARG_MAX */
925e9cd1aeSAssar Westerlund
935e9cd1aeSAssar Westerlund#define	GLOB_NOSPACE	(-1)	/* Malloc call failed. */
945e9cd1aeSAssar Westerlund#define	GLOB_ABEND	(-2)	/* Unignored error. */
955e9cd1aeSAssar Westerlund
96c19800e8SDoug Rabsonint ROKEN_LIB_FUNCTION
97c19800e8SDoug Rabsonglob (const char *, int, int (*)(const char *, int), glob_t *);
98c19800e8SDoug Rabson
99c19800e8SDoug Rabsonvoid ROKEN_LIB_FUNCTION
100c19800e8SDoug Rabsonglobfree (glob_t *);
101c19800e8SDoug Rabson
102c19800e8SDoug Rabson#ifdef __cplusplus
103c19800e8SDoug Rabson}
104c19800e8SDoug Rabson#endif
1055e9cd1aeSAssar Westerlund
1065e9cd1aeSAssar Westerlund#endif /* !_GLOB_H_ */
107