65816-llvm-mos/runtime/include/glob.h
2026-10-13 13:58:56 -05:00

50 lines
1.3 KiB
C

// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// 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