xref: /titanic_50/usr/src/head/glob.h (revision 3f7d54a6b84904c8f4d8daa4c7b577bede7df8b9)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Copyright 1985, 1992 by Mortice Kern Systems Inc.  All rights reserved.
29  */
30 
31 #ifndef	_GLOB_H
32 #define	_GLOB_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <sys/feature_tests.h>
37 #include <sys/types.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 typedef	struct	glob_t	{
44 	size_t	gl_pathc;		/* Count of paths matched by pattern */
45 	char	**gl_pathv;		/* List of matched pathnames */
46 	size_t	gl_offs;		/* # of slots reserved in gl_pathv */
47 	/* following are internal to the implementation */
48 	char	**gl_pathp;		/* gl_pathv + gl_offs */
49 	int	gl_pathn;		/* # of elements allocated */
50 }	glob_t;
51 
52 /*
53  * "flags" argument to glob function.
54  */
55 #define	GLOB_ERR	0x0001		/* Don't continue on directory error */
56 #define	GLOB_MARK	0x0002		/* Mark directories with trailing / */
57 #define	GLOB_NOSORT	0x0004		/* Don't sort pathnames */
58 #define	GLOB_NOCHECK	0x0008		/* Return unquoted arg if no match */
59 #define	GLOB_DOOFFS	0x0010		/* Ignore gl_offs unless set */
60 #define	GLOB_APPEND	0x0020		/* Append to previous glob_t */
61 #define	GLOB_NOESCAPE	0x0040		/* Backslashes do not quote M-chars */
62 
63 /*
64  * Error returns from "glob"
65  */
66 #define	GLOB_NOSYS	(-4)		/* function not supported (XPG4) */
67 #define	GLOB_NOMATCH	(-3)		/* Pattern does not match */
68 #define	GLOB_NOSPACE	(-2)		/* Not enough memory */
69 #define	GLOB_ABORTED	(-1)		/* GLOB_ERR set or errfunc return!=0 */
70 
71 #if defined(__STDC__)
72 extern int glob(const char *_RESTRICT_KYWD, int, int(*)(const char *, int),
73 		glob_t *_RESTRICT_KYWD);
74 extern void globfree(glob_t *);
75 #else
76 extern int glob();
77 extern void globfree();
78 #endif
79 
80 #ifdef	__cplusplus
81 }
82 #endif
83 
84 #endif	/* _GLOB_H */
85