glob(5)
glob --
pathname pattern-matching utilities
Synopsis
#include <glob.h>
Description
The glob.h header declares the type glob_t which includes the following
members:
- size_t gl_pathc
-
Number of paths pattern matches
- char **gl_pathv
-
A pointer to a list of pathnames that have been matched
- size_t gl_offs
-
Slots to be reserved.
Found at the beginning of gl_pathv
The following functions are declared:
int glob(const char *pattern, int flags,
int (*errfunc)(const char *epath, int eerrno),
glob_t *pglob);
void globfree (glob_t *pglob);
The flags argument requires a set of values.
The following constants are provided as values for flag:
- GLOB_APPEND
-
Append newly formed pathnames to previously obtained ones
- GLOB_DOOFFS
-
A specification of the number of null pointers that should be
added to the start of pglob-> gl_pathv
- GLOB_ERR
-
This is to ensure that if an error occurs, glob is returned
- GLOB_MARK
-
A slash is appended to each directory pathname matching
pattern
- GLOB_NOCHECK
-
If there is no match between a pathname and pattern
then a list is returned which contains pattern only
- GLOB_NOESCAPE
-
disable backslash escaping
- GLOB_NOSORT
-
Pathnames that are returned are not to be sorted
Error return values have the following constants defined:
- GLOB_ABORTED
-
Because (*errfunc) returned zero or GLOB_ERR was set,
scanning was terminated.
- GLOB_NOMATCH
-
There is no match between the pattern and any pathname that
exists.
GLOB_NOCHECK was not set in flags.
- GLOB_NOSPACE
-
Memory allocation failure
- GLOB_NOSYS
-
Function not supported by this implementation.
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.