#ifndef ZLOB_H
#define ZLOB_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
typedef struct {
const char *d_name;
unsigned char
d_type;
} zlob_dirent_t;
#define ZLOB_DT_UNKNOWN 0
#define ZLOB_DT_DIR 4
#define ZLOB_DT_REG 8
#define ZLOB_DT_LNK 10
typedef struct {
size_t zlo_pathc;
char **zlo_pathv;
size_t zlo_offs;
size_t * zlo_pathlen;
int zlo_flags;
void *(*zlo_opendir)(
const char *path);
zlob_dirent_t *(*zlo_readdir)(
void *dir);
void (*zlo_closedir)(void *dir);
} zlob_t;
#define ZLOB_ERR (1 << 0)
#define ZLOB_MARK \
(1 << 1)
#define ZLOB_NOSORT (1 << 2)
#define ZLOB_DOOFFS \
(1 << 3)
#define ZLOB_NOCHECK \
(1 << 4)
#define ZLOB_APPEND \
(1 << 5)
#define ZLOB_NOESCAPE \
(1 << 6)
#define ZLOB_PERIOD \
(1 << 7)
#define ZLOB_MAGCHAR \
(1 << 8)
#define ZLOB_ALTDIRFUNC \
(1 << 9)
#define ZLOB_BRACE (1 << 10)
#define ZLOB_NOMAGIC \
(1 << 11)
#define ZLOB_TILDE \
(1 << 12)
#define ZLOB_ONLYDIR (1 << 13)
#define ZLOB_TILDE_CHECK \
(1 << 14)
#define ZLOB_GITIGNORE (1 << 24)
#define ZLOB_DOUBLESTAR_RECURSIVE \
(1 << 25)
#define ZLOB_EXTGLOB \
(1 << 26)
#define ZLOB_RECOMMENDED \
(ZLOB_BRACE | ZLOB_DOUBLESTAR_RECURSIVE | ZLOB_NOSORT | ZLOB_TILDE | \
ZLOB_TILDE_CHECK)
#define ZLOB_NOSPACE 1
#define ZLOB_ABORTED 2
#define ZLOB_NOMATCH 3
int zlob(const char *restrict pattern, int flags,
int (*errfunc)(const char *epath, int eerrno), zlob_t *restrict pzlob);
void zlobfree(zlob_t *pzlob);
int zlob_at(const char *base_path, const char *restrict pattern, int flags,
int (*errfunc)(const char *epath, int eerrno),
zlob_t *restrict pzlob);
typedef struct {
const unsigned char *ptr;
size_t len;
} zlob_slice_t;
int zlob_match_paths_slice(const zlob_slice_t *pattern,
const zlob_slice_t *paths, size_t path_count,
int flags, zlob_t *pzlob);
int zlob_match_paths(const char *pattern, const char *const *paths,
size_t path_count, int flags, zlob_t *pzlob);
int zlob_match_paths_at(const char *base_path, const char *pattern,
const char *const *paths, size_t path_count, int flags,
zlob_t *pzlob);
int zlob_match_paths_at_slice(const zlob_slice_t *base_path,
const zlob_slice_t *pattern,
const zlob_slice_t *paths, size_t path_count,
int flags, zlob_t *pzlob);
int zlob_has_wildcards(const char *pattern, int flags);
#ifdef __cplusplus
}
#endif
#endif