Node:Calling Glob, Next:Flags for Globbing, Up:Globbing
glob
The result of globbing is a vector of file names (strings). To return
this vector, glob
uses a special data type, glob_t
, which
is a structure. You pass glob
the address of the structure, and
it fills in the structure's fields to tell you about the results.
glob_t | Data Type |
This data type holds a pointer to a word vector. More precisely, it
records both the address of the word vector and its size. The GNU
implementation contains some more fields which are non-standard
extensions.
|
For use in the glob64
function glob.h
contains another
definition for a very similar type. glob64_t
differs from
glob_t
only in the types of the members gl_readdir
,
gl_stat
, and gl_lstat
.
glob64_t | Data Type |
This data type holds a pointer to a word vector. More precisely, it
records both the address of the word vector and its size. The GNU
implementation contains some more fields which are non-standard
extensions.
|
int glob (const char *pattern, int flags, int (*errfunc) (const char *filename, int error-code), glob_t *vector-ptr) | Function |
The function glob does globbing using the pattern pattern
in the current directory. It puts the result in a newly allocated
vector, and stores the size and address of this vector into
*vector-ptr . The argument flags is a combination of
bit flags; see Flags for Globbing, for details of the flags.
The result of globbing is a sequence of file names. The function
To return this vector, Normally, If
In the event of an error, It is important to notice that the |
int glob64 (const char *pattern, int flags, int (*errfunc) (const char *filename, int error-code), glob64_t *vector-ptr) | Function |
The glob64 function was added as part of the Large File Summit
extensions but is not part of the original LFS proposal. The reason for
this is simple: it is not necessary. The necessity for a glob64
function is added by the extensions of the GNU glob
implementation which allows the user to provide own directory handling
and stat functions. The readdir and stat functions
do depend on the choice of _FILE_OFFSET_BITS since the definition
of the types struct dirent and struct stat will change
depending on the choice.
Beside this difference the This function is a GNU extension. |