1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
--- a/glob.c (index)
+++ b/glob.c (working tree)
@@ -82,17 +82,19 @@ __FBSDID("$FreeBSD$");
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
-#include <glob.h>
+#include "glob.h"
#include <limits.h>
#include <pwd.h>
#include <stdint.h>
#include <stdio.h>
-#include <stdlib.h>
+#include "stdlib.h"
#include <string.h>
-#include <unistd.h>
+#include "unistd.h"
#include <wchar.h>
+#ifdef USE_LOCALE_COLLATE
#include "collate.h"
+#endif
/*
* glob(3) expansion limits. Stop the expansion if any of these limits
@@ -911,8 +913,10 @@ match(Char *name, Char *pat, Char *patend)
{
int ok, negate_range;
Char c, k, *nextp, *nextn;
+#ifdef USE_LOCALE_COLLATE
struct xlocale_collate *table =
(struct xlocale_collate*)__get_locale()->components[XLC_COLLATE];
+#endif
nextn = NULL;
nextp = NULL;
@@ -942,6 +946,7 @@ match(Char *name, Char *pat, Char *patend)
++pat;
while (((c = *pat++) & M_MASK) != M_END)
if ((*pat & M_MASK) == M_RNG) {
+#ifdef USE_LOCALE_COLLATE
if (table->__collate_load_error ?
CHAR(c) <= CHAR(k) &&
CHAR(k) <= CHAR(pat[1]) :
@@ -949,6 +954,9 @@ match(Char *name, Char *pat, Char *patend)
CHAR(k)) <= 0 &&
__wcollate_range_cmp(CHAR(k),
CHAR(pat[1])) <= 0)
+#else
+ if (c <= k && k <= pat[1])
+#endif
ok = 1;
pat += 2;
} else if (c == k)
--- a/stdlib.h (index)
+++ b/stdlib.h (working tree)
@@ -0,0 +1,3 @@
+#include <stdlib.h>
+
+void* reallocarray(void*, size_t, size_t);
--- a/unistd.h (index)
+++ b/unistd.h (working tree)
@@ -0,0 +1,3 @@
+#include <unistd.h>
+
+#define issetugid() 0
--- a/glob.h (index)
+++ b/glob.h (working tree)
@@ -39,12 +39,8 @@
#define _GLOB_H_
#include <sys/cdefs.h>
-#include <sys/_types.h>
+#include <sys/types.h>
-#ifndef _SIZE_T_DECLARED
-typedef __size_t size_t;
-#define _SIZE_T_DECLARED
-#endif
struct stat;
typedef struct {
@@ -68,7 +64,7 @@ typedef struct {
int (*gl_stat)(const char *, struct stat *);
} glob_t;
-#if __POSIX_VISIBLE >= 199209
+// #if __POSIX_VISIBLE >= 199209
/* Believed to have been introduced in 1003.2-1992 */
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
@@ -83,9 +79,9 @@ typedef struct {
#define GLOB_ABORTED (-2) /* Unignored error. */
#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK was not set. */
#define GLOB_NOSYS (-4) /* Obsolete: source comptability only. */
-#endif /* __POSIX_VISIBLE >= 199209 */
+// #endif /* __POSIX_VISIBLE >= 199209 */
-#if __BSD_VISIBLE
+// #if __BSD_VISIBLE
#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
@@ -97,7 +93,7 @@ typedef struct {
/* source compatibility, these are the old names */
#define GLOB_MAXPATH GLOB_LIMIT
#define GLOB_ABEND GLOB_ABORTED
-#endif /* __BSD_VISIBLE */
+// #endif /* __BSD_VISIBLE */
__BEGIN_DECLS
int glob(const char * __restrict, int,
|