--- a/glob.c (index) +++ b/glob.c (working tree) @@ -82,17 +82,19 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include "glob.h" #include #include #include #include -#include +#include "stdlib.h" #include -#include +#include "unistd.h" #include +#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 + +void* reallocarray(void*, size_t, size_t); --- a/unistd.h (index) +++ b/unistd.h (working tree) @@ -0,0 +1,3 @@ +#include + +#define issetugid() 0 --- a/glob.h (index) +++ b/glob.h (working tree) @@ -39,12 +39,8 @@ #define _GLOB_H_ #include -#include +#include -#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,