diff options
Diffstat (limited to 'win32/glob.h')
-rw-r--r-- | win32/glob.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/win32/glob.h b/win32/glob.h new file mode 100644 index 000000000..a8141b8bf --- /dev/null +++ b/win32/glob.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | glob from musl (https://www.musl-libc.org/). | ||
3 | |||
4 | MIT licensed: | ||
5 | |||
6 | ---------------------------------------------------------------------- | ||
7 | Copyright © 2005-2020 Rich Felker, et al. | ||
8 | |||
9 | Permission is hereby granted, free of charge, to any person obtaining | ||
10 | a copy of this software and associated documentation files (the | ||
11 | "Software"), to deal in the Software without restriction, including | ||
12 | without limitation the rights to use, copy, modify, merge, publish, | ||
13 | distribute, sublicense, and/or sell copies of the Software, and to | ||
14 | permit persons to whom the Software is furnished to do so, subject to | ||
15 | the following conditions: | ||
16 | |||
17 | The above copyright notice and this permission notice shall be | ||
18 | included in all copies or substantial portions of the Software. | ||
19 | |||
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
23 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
24 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
25 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
26 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
27 | ---------------------------------------------------------------------- | ||
28 | */ | ||
29 | #ifndef _GLOB_H | ||
30 | #define _GLOB_H | ||
31 | |||
32 | #ifdef __cplusplus | ||
33 | extern "C" { | ||
34 | #endif | ||
35 | |||
36 | typedef struct { | ||
37 | size_t gl_pathc; | ||
38 | char **gl_pathv; | ||
39 | size_t gl_offs; | ||
40 | int __dummy1; | ||
41 | void *__dummy2[5]; | ||
42 | } glob_t; | ||
43 | |||
44 | int glob(const char *__restrict, int, int (*)(const char *, int), glob_t *__restrict); | ||
45 | void globfree(glob_t *); | ||
46 | |||
47 | #if ENABLE_PLATFORM_MINGW32 | ||
48 | // Set some flags to zero so the compiler can exclude unused code. | ||
49 | #define GLOB_ERR 0 | ||
50 | #define GLOB_MARK 0 | ||
51 | #define GLOB_NOSORT 0x04 | ||
52 | #define GLOB_DOOFFS 0 | ||
53 | #define GLOB_NOCHECK 0x10 | ||
54 | #define GLOB_APPEND 0 | ||
55 | #define GLOB_NOESCAPE 0x40 | ||
56 | #define GLOB_PERIOD 0 | ||
57 | |||
58 | #define GLOB_TILDE 0 | ||
59 | #define GLOB_TILDE_CHECK 0 | ||
60 | #else | ||
61 | #define GLOB_ERR 0x01 | ||
62 | #define GLOB_MARK 0x02 | ||
63 | #define GLOB_NOSORT 0x04 | ||
64 | #define GLOB_DOOFFS 0x08 | ||
65 | #define GLOB_NOCHECK 0x10 | ||
66 | #define GLOB_APPEND 0x20 | ||
67 | #define GLOB_NOESCAPE 0x40 | ||
68 | #define GLOB_PERIOD 0x80 | ||
69 | |||
70 | #define GLOB_TILDE 0x1000 | ||
71 | #define GLOB_TILDE_CHECK 0x4000 | ||
72 | #endif | ||
73 | |||
74 | #define GLOB_NOSPACE 1 | ||
75 | #define GLOB_ABORTED 2 | ||
76 | #define GLOB_NOMATCH 3 | ||
77 | #define GLOB_NOSYS 4 | ||
78 | |||
79 | #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) | ||
80 | #define glob64 glob | ||
81 | #define globfree64 globfree | ||
82 | #define glob64_t glob_t | ||
83 | #endif | ||
84 | |||
85 | #ifdef __cplusplus | ||
86 | } | ||
87 | #endif | ||
88 | |||
89 | #endif | ||