]>
Commit | Line | Data |
---|---|---|
d7ce7006 | 1 | /* $NetBSD: glob.h,v 1.24 2008/09/13 17:05:07 christos Exp $ */\r |
2 | \r | |
3 | /*\r | |
4 | * Copyright (c) 1989, 1993\r | |
5 | * The Regents of the University of California. All rights reserved.\r | |
6 | *\r | |
7 | * This code is derived from software contributed to Berkeley by\r | |
8 | * Guido van Rossum.\r | |
9 | *\r | |
10 | * Redistribution and use in source and binary forms, with or without\r | |
11 | * modification, are permitted provided that the following conditions\r | |
12 | * are met:\r | |
13 | * 1. Redistributions of source code must retain the above copyright\r | |
14 | * notice, this list of conditions and the following disclaimer.\r | |
15 | * 2. Redistributions in binary form must reproduce the above copyright\r | |
16 | * notice, this list of conditions and the following disclaimer in the\r | |
17 | * documentation and/or other materials provided with the distribution.\r | |
18 | * 3. Neither the name of the University nor the names of its contributors\r | |
19 | * may be used to endorse or promote products derived from this software\r | |
20 | * without specific prior written permission.\r | |
21 | *\r | |
22 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r | |
23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r | |
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r | |
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r | |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r | |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r | |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r | |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r | |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r | |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r | |
32 | * SUCH DAMAGE.\r | |
33 | *\r | |
34 | * @(#)glob.h 8.1 (Berkeley) 6/2/93\r | |
35 | */\r | |
36 | \r | |
37 | #ifndef _GLOB_H_\r | |
38 | #define _GLOB_H_\r | |
39 | \r | |
40 | #include <sys/cdefs.h>\r | |
41 | #include <sys/featuretest.h>\r | |
42 | #include <sys/types.h>\r | |
43 | #include <sys/stat.h>\r | |
44 | \r | |
45 | #ifndef __gl_size_t\r | |
46 | #define __gl_size_t size_t\r | |
47 | #endif\r | |
48 | #ifndef __gl_stat_t\r | |
49 | #define __gl_stat_t struct stat\r | |
50 | #endif\r | |
51 | \r | |
52 | typedef struct {\r | |
53 | __gl_size_t gl_pathc; /* Count of total paths so far. */\r | |
54 | __gl_size_t gl_matchc; /* Count of paths matching pattern. */\r | |
55 | __gl_size_t gl_offs; /* Reserved at beginning of gl_pathv. */\r | |
56 | int gl_flags; /* Copy of flags parameter to glob. */\r | |
57 | char **gl_pathv; /* List of paths matching pattern. */\r | |
58 | /* Copy of errfunc parameter to glob. */\r | |
59 | int (*gl_errfunc)(const char *, int);\r | |
60 | \r | |
61 | /*\r | |
62 | * Alternate filesystem access methods for glob; replacement\r | |
63 | * versions of closedir(3), readdir(3), opendir(3), stat(2)\r | |
64 | * and lstat(2).\r | |
65 | */\r | |
66 | void (*gl_closedir)(void *);\r | |
67 | struct dirent *(*gl_readdir)(void *); \r | |
68 | void *(*gl_opendir)(const char *);\r | |
69 | int (*gl_lstat)(const char *, __gl_stat_t *);\r | |
70 | int (*gl_stat)(const char *, __gl_stat_t *);\r | |
71 | } glob_t;\r | |
72 | \r | |
73 | #define GLOB_APPEND 0x0001 /* Append to output from previous call. */\r | |
74 | #define GLOB_DOOFFS 0x0002 /* Use gl_offs. */\r | |
75 | #define GLOB_ERR 0x0004 /* Return on error. */\r | |
76 | #define GLOB_MARK 0x0008 /* Append / to matching directories. */\r | |
77 | #define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */\r | |
78 | #define GLOB_NOSORT 0x0020 /* Don't sort. */\r | |
79 | #define GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */\r | |
80 | \r | |
81 | #define GLOB_NOSPACE (-1) /* Malloc call failed. */\r | |
82 | #define GLOB_ABORTED (-2) /* Unignored error. */\r | |
83 | #define GLOB_NOMATCH (-3) /* No match, and GLOB_NOCHECK was not set. */\r | |
84 | #define GLOB_NOSYS (-4) /* Implementation does not support function. */\r | |
85 | \r | |
86 | #if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)\r | |
87 | #define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */\r | |
88 | #define GLOB_BRACE 0x0080 /* Expand braces ala csh. */\r | |
89 | #define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */\r | |
90 | #define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */\r | |
91 | #define GLOB_LIMIT 0x0400 /* Limit memory used by matches to ARG_MAX */\r | |
92 | #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */\r | |
93 | /* GLOB_NOESCAPE 0x1000 above */\r | |
94 | #define GLOB_PERIOD 0x2000 /* Allow metachars to match leading periods. */\r | |
95 | #define GLOB_NO_DOTDIRS 0x4000 /* Make . and .. vanish from wildcards. */\r | |
96 | #define GLOB_QUOTE 0 /* source compatibility */\r | |
97 | \r | |
98 | #define GLOB_ABEND GLOB_ABORTED /* source compatibility */\r | |
99 | #endif\r | |
100 | \r | |
101 | __BEGIN_DECLS\r | |
102 | #ifndef __LIBC12_SOURCE__\r | |
103 | int glob(const char * __restrict, int,\r | |
104 | int (*)(const char *, int), glob_t * __restrict) __RENAME(__glob30);\r | |
105 | void globfree(glob_t *) __RENAME(__globfree30);\r | |
106 | #endif\r | |
107 | __END_DECLS\r | |
108 | \r | |
109 | #endif /* !_GLOB_H_ */\r |