|
BRL-CAD
|
Routines and structures for getting a list of entities that match a given pattern. More...
Files | |
| file | glob.h |
Data Structures | |
| struct | bu_dirent |
| struct | bu_stat |
| struct | bu_glob_context |
Typedefs | |
| typedef struct bu_glob_context | bu_glob_t |
Functions | |
| struct bu_glob_context * | bu_glob_ctx_create (void) |
| void | bu_glob_ctx_destroy (struct bu_glob_context *) |
| int | bu_glob (const char *pattern, int flags, struct bu_glob_context *context) |
Routines and structures for getting a list of entities that match a given pattern.
The bu_glob API is a portable, callback-based glob implementation modelled on POSIX glob(3) and inspired by OpenBSD's glob.c. By supplying custom opendir/readdir/closedir/lstat/stat callbacks any hierarchical namespace (filesystem, BRL-CAD .g database, etc.) can be searched. The default callbacks use the system filesystem.
See also: src/librt/db_glob.c for the geometry-database backend (db_path_glob) which plugs into this API.
| typedef struct bu_glob_context bu_glob_t |
| struct bu_glob_context * bu_glob_ctx_create | ( | void | ) |
Create a globbing context
|
extern |
release any resources allocated during bu_glob(), including any returned paths
|
extern |
Match a pattern against a set of elements.
This interface is a somewhat simplified and abstracted version of UNIX glob matching, based loosely on the interface specified in POSIX.2. It supports user specified callback functions allowing callers to glob nearly any named storage structure. By default, globbing will map to the local filesystem.
Function takes an input pattern, a set of flags, and a globbing context from bu_glob_ctx_create().
Returns zero on success, non-zero on failure.
gl_pathc will contain the total number of paths matched. This will increment previous glob counts if GLOB_APPEND is specified.
gl_matchc will contain the number of matched paths for this invocation of bu_glob().
gl_pathv contains a list of matched paths.