65816-llvm-mos/runtime/include/glob.h
Scott Duensing da095402ec Updated
2026-06-02 23:17:57 -05:00

46 lines
1.1 KiB
C

// glob.h — POSIX pathname expansion.
//
// glob(pattern, flags, errfunc, &gb) iterates the directory portion
// of `pattern` via the GS/OS Get_Dir_Entry ($201C) call and stashes
// matches (against `pattern`'s leaf via fnmatch) into gb.gl_pathv.
// On a stub-only build (no real GS/OS dispatcher), glob() returns
// GLOB_NOMATCH with errno=ENOSYS unless GLOB_NOCHECK is set, in
// which case it returns a single-element result containing the
// original pattern.
//
// globfree() releases the malloc'd gl_pathv vector + entries.
#ifndef _GLOB_H
#define _GLOB_H
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long size_t;
typedef struct {
size_t gl_pathc;
char **gl_pathv;
size_t gl_offs;
} glob_t;
#define GLOB_NOSPACE 1
#define GLOB_ABORTED 2
#define GLOB_NOMATCH 3
#define GLOB_ERR 0x01
#define GLOB_MARK 0x02
#define GLOB_NOSORT 0x04
#define GLOB_NOCHECK 0x10
#define GLOB_NOESCAPE 0x40
int glob(const char *pattern, int flags,
int (*errfunc)(const char *, int),
glob_t *pglob);
void globfree(glob_t *pglob);
#ifdef __cplusplus
}
#endif
#endif