HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
g
glob(3C) glob(3C)
The count returned in pglob >gl_pathc will be the total number of path names from the two
calls.
The application can change any of the fields after a call to glob(). If it does, it must reset
them to the original value before a subsequent call, using the same pglob value, to glob-
free()
or glob() with the GLOB_APPEND flag.
If, during the search, a directory is encountered that cannot be opened or read and errfunc is not NULL,
glob() calls (errfunc)() with two arguments:
A pointer to the path that failed.
The value of errno from the failure.
If errfunc is called and returns nonzero, or if the GLOB_ERR flag is set in flags, glob() stops the scan
and returns GLOB_ABORTED after setting gl_pathc and gl_pathv in pglob to reflect the paths
already scanned. If GLOB_ERR is not set and either errfunc is NULL or (errfunc)() returns zero, the
error is ignored.
Pattern Matching Notation
The form of the patterns is the Pattern Matching Notation as qualified for Filename Expansion (see
regexp(5)) with the following exceptions:
Tilde (˜) expansion is not performed.
Variable expansion is not performed.
APPLICATION USAGE
glob() and globfree() are thread-safe. These interfaces are not async-cancel-safe. A cancellation
point may occur when a thread is executing glob() or globfree() .
EXTERNAL INFLUENCES
Locale
The LC_COLLATE category determines the collating sequence used in compiling and executing regular
expressions, and also the order of the returned paths if GLOB_NOSORT is not selected.
The LC_CTYPE category determines the interpretation of text as single byte and/or multibyte characters,
and determines which characters are matched by character class expressions in regular expressions.
International Code Set Support
Single byte and multibyte character code sets are supported.
RETURN VALUE
If glob() terminates due to an error, it returns one of the following constants (defined in
<glob.h>);
otherwise, it returns zero.
GLOB_NOSPACE An attempt to allocate memory failed.
GLOB_ABORTED The scan was stopped because GLOB_ERR was set or (errfunc)() returned
nonzero.
GLOB_NOMATCH The pattern does not match any existing path name, and GLOB_NOCHECK was
not set in flags.
In any case, the argument pglob>gl_pathc returns the number of matched path names and the argument
pglob>gl_pathv contains a pointer to a null-terminated list of matched and sorted path names.
However, if pglob >gl_pathc is zero, the content of pglob>gl_pathv is undefined.
If the pattern argument passed to
glob() is badly constructed, glob() returns zero and sets
gl_pathc to zero unless GLOB_NOCHECK was set, in which case pattern is returned and gl_pathc is
set to 1.
WARNINGS
GLOB_APPEND must not be set in an initial call to glob().
AUTHOR
glob() and globfree() were developed by OSF and HP.
HP-UX Release 11i: December 2000 2 Section 3375
___
___