diff options
Diffstat (limited to 'src/glob/glob.c')
| -rw-r--r-- | src/glob/glob.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/glob/glob.c b/src/glob/glob.c index 15e30731..e8e6b8a6 100644 --- a/src/glob/glob.c +++ b/src/glob/glob.c @@ -1,3 +1,4 @@ +#include "sys/types.h" #include <glob.h> #include "stdlib.h" #include "string.h" @@ -5,14 +6,18 @@ #include "fnmatch.h" #include "errno.h" #include "unistd.h" -#include "__nonstd.h" +#include "nonstd/assert.h" int glob(const char * restrict pattern, int flags, int (*errfunc) (const char * epath, int eerrno), glob_t * restrict pglob) { - __ASSERT_NONNULL(pattern); - __ASSERT_NONNULL(pglob); + ASSERT_NONNULL(pattern); + ASSERT_NONNULL(pglob); + + int slashes = 0; + size_t i; int fnmatch_flags = FNM_PATHNAME | FNM_PERIOD; + if (flags & GLOB_NOESCAPE) { fnmatch_flags |= FNM_NOESCAPE; } @@ -32,9 +37,8 @@ int glob(const char * restrict pattern, int flags, int (*errfunc) (const char * } char *path = strdup(pattern); - int slashes = 0; - for (size_t i = 0; path[i]; i++) { + for (i = 0; path[i]; i++) { if (path[i] == '/') { slashes++; path[i] = '\0'; |
