Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

OSS Library Calls (g - h) glob(3)
NAME
glob - Generates pathnames matching a pattern
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossesrl
H-series OSS processes: /G/system/zdllnnn/zossedll
SYNOPSIS
#include <glob.h>
int glob(
const char *pattern,
int ags,
int (*errfunc)(constr char *epath, int eerrno),
glob_t *pglob);
PARAMETERS
pattern Contains the lename pattern to compare against accessible pathnames.
flags Controls the customizable behavior of the glob() function.
errfunc Species an optional function that, if specied, is called when the glob() func-
tion detects an error condition.
epath Contains the pathname that failed because a directory could not be opened or
read.
eerrno Species the errno value from a failure specied by the epath parameter, as set
by the opendir( ), readdir(),orstat() function.
pglob Contains a pointer to a glob_t structure. The structure is allocated by the caller.
The array of structures containing the lenames that match the pattern parameter
is stored by the glob() function into the structure. The last entry is a null pointer.
DESCRIPTION
The glob() function constructs a list of accessible les whose names match the pattern parame-
ter.
The glob() function matches all accessible pathnames against pattern and develops a list of all
pathnames that match. To have access to a pathname, the glob() function requires search per-
mission on every component of the pathname except the last and requires read permission on
each directory of any lename component of pattern that contains any of the special characters *
(asterisk), ? (question mark), or [ (open bracket).
The glob() function stores the number of matched pathnames and a pointer to a list of pointers to
pathnames in the glob_t structure pointed to by the pglob parameter. The glob_t structure has the
following format:
typedef struct glob_t {
size_t gl_pathc;
char **gl_pathv;
size_t gl_offs;
void *gl_padr;
void *gl_ptx;
}glob_t;
The elds in the structure have the following content:
gl_pathc The count of the pathnames that match the specied pattern.
527187-004 Hewlett-Packard Company 387