xref: /titanic_41/usr/src/lib/libast/sparc/include/ast/glob.h (revision 634e26ec75c89095090605284938356a3145f2b8)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *          Copyright (c) 1985-2009 AT&T Intellectual Property          *
7 *                      and is licensed under the                       *
8 *                  Common Public License, Version 1.0                  *
9 *                    by AT&T Intellectual Property                     *
10 *                                                                      *
11 *                A copy of the License is available at                 *
12 *            http://www.opensource.org/licenses/cpl1.0.txt             *
13 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14 *                                                                      *
15 *              Information and Software Systems Research               *
16 *                            AT&T Research                             *
17 *                           Florham Park NJ                            *
18 *                                                                      *
19 *                 Glenn Fowler <gsf@research.att.com>                  *
20 *                  David Korn <dgk@research.att.com>                   *
21 *                   Phong Vo <kpv@research.att.com>                    *
22 *                                                                      *
23 ***********************************************************************/
24 
25 /*
26  * posix glob interface definitions with gnu extensions
27  */
28 
29 #ifndef _GLOB_H
30 #if !defined(__PROTO__)
31 #include <prototyped.h>
32 #endif
33 #if !defined(__LINKAGE__)
34 #define __LINKAGE__		/* 2004-08-11 transition */
35 #endif
36 
37 #define _GLOB_H
38 
39 #define GLOB_VERSION	20060717L
40 
41 #include <stdlib.h>
42 
43 struct dirent;
44 struct stat;
45 
46 struct _glob_;
47 struct _globlist_;
48 
49 typedef struct _glob_ glob_t;
50 typedef struct _globlist_ globlist_t;
51 
52 struct _globlist_
53 {
54 	globlist_t*	gl_next;
55 	char*		gl_begin;
56 	unsigned char	gl_flags;
57 	char		gl_path[1];
58 };
59 
60 struct _glob_
61 {
62 	size_t		gl_pathc;
63 	char**		gl_pathv;
64 	size_t		gl_offs;
65 	globlist_t*	gl_list;
66 	int		gl_flags;
67 
68 	/* GLOB_DISC data -- memset(&gl,0,sizeof(gl)) before using! */
69 
70 	const char*	gl_fignore;
71 	const char*	gl_suffix;
72 	unsigned char*	gl_intr;
73 
74 	int		gl_delim;
75 
76 	__V_*		gl_handle;
77 	__V_*		(*gl_diropen) __PROTO__((glob_t*, const char*));
78 	char*		(*gl_dirnext) __PROTO__((glob_t*, __V_*));
79 	void		(*gl_dirclose) __PROTO__((glob_t*, __V_*));
80 	int		(*gl_type) __PROTO__((glob_t*, const char*, int));
81 	int		(*gl_attr) __PROTO__((glob_t*, const char*, int));
82 
83 	/* gnu extensions -- but how do you synthesize dirent and stat? */
84 
85 	__V_*		(*gl_opendir) __PROTO__((const char*));
86 	struct dirent*	(*gl_readdir) __PROTO__((__V_*));
87 	void		(*gl_closedir) __PROTO__((__V_*));
88 	int		(*gl_stat) __PROTO__((const char*, struct stat*));
89 	int		(*gl_lstat) __PROTO__((const char*, struct stat*));
90 
91 	/* ast additions */
92 
93 	char*		(*gl_nextdir) __PROTO__((glob_t*, char*));
94 	unsigned long	gl_status;
95 	unsigned long	gl_version;
96 	unsigned short	gl_extra;
97 
98 #ifdef _GLOB_PRIVATE_
99 	_GLOB_PRIVATE_
100 #else
101 	char*		gl_pad[23];
102 #endif
103 
104 };
105 
106 /* standard interface */
107 #define GLOB_APPEND	0x0001		/* append to previous		*/
108 #define GLOB_DOOFFS	0x0002		/* gl_offs defines argv offset	*/
109 #define GLOB_ERR	0x0004		/* abort on error		*/
110 #define GLOB_MARK	0x0008		/* append / to directories	*/
111 #define GLOB_NOCHECK	0x0010		/* nomatch is original pattern	*/
112 #define GLOB_NOESCAPE	0x0020		/* don't treat \ specially	*/
113 #define GLOB_NOSORT	0x0040		/* don't sort the list		*/
114 
115 /* extended interface */
116 #define GLOB_STARSTAR	0x0080		/* enable [/]**[/] expansion	*/
117 #define GLOB_BRACE	0x0100		/* enable {...} expansion	*/
118 #define GLOB_ICASE	0x0200		/* ignore case on match		*/
119 #define GLOB_COMPLETE	0x0400		/* shell file completeion	*/
120 #define GLOB_AUGMENTED	0x0800		/* augmented shell patterns	*/
121 #define GLOB_STACK	0x1000		/* allocate on current stack	*/
122 #define GLOB_LIST	0x2000		/* just create gl_list		*/
123 #define GLOB_ALTDIRFUNC	0x4000		/* gnu discipline functions	*/
124 #define GLOB_DISC	0x8000		/* discipline initialized	*/
125 
126 /* gl_status */
127 #define GLOB_NOTDIR	0x0001		/* last gl_dirnext() not a dir	*/
128 
129 /* gl_type return */
130 #define GLOB_NOTFOUND	0		/* does not exist		*/
131 #define GLOB_DEV	1		/* exists but not DIR EXE REG	*/
132 #define GLOB_DIR	2		/* directory			*/
133 #define GLOB_EXE	3		/* executable regular file	*/
134 #define GLOB_REG	4		/* regular file			*/
135 
136 /* error return values */
137 #define GLOB_ABORTED	1
138 #define GLOB_NOMATCH	2
139 #define GLOB_NOSPACE	3
140 #define GLOB_INTR	4
141 #define GLOB_APPERR	5
142 #define GLOB_NOSYS	6
143 
144 #if _BLD_ast && defined(__EXPORT__)
145 #undef __MANGLE__
146 #define __MANGLE__ __LINKAGE__		__EXPORT__
147 #endif
148 
149 extern __MANGLE__ int	glob __PROTO__((const char*, int, int(*)(const char*,int), glob_t*));
150 extern __MANGLE__ void	globfree __PROTO__((glob_t*));
151 
152 #undef __MANGLE__
153 #define __MANGLE__ __LINKAGE__
154 
155 #endif /* _GLOB_H */
156