This section describes the flags that you can specify in the
flags argument to
glob. Choose the flags you want,
and combine them with the C bitwise OR operator
glob. This way you can effectively expand several words as if they were concatenated with spaces between them. In order for appending to work, you must not modify the contents of the word vector structure between calls to
glob. And, if you set
GLOB_DOOFFSin the first call to
glob, you must also set it when you append to the results. Note that the pointer stored in
gl_pathvmay no longer be valid after you call
globthe second time, because
globmight have relocated the vector. So always fetch
glob_tstructure after each
globcall; never save the pointer across calls.
gl_offsfield says how many slots to leave. The blank slots contain null pointers.
globtries its best to keep on going despite any errors, reading whatever directories it can. You can exercise even more control than this by specifying an error-handler function errfunc when you call
glob. If errfunc is not a null pointer, then
globdoesn't give up right away when it can't read a directory; instead, it calls errfunc with two arguments, like this:
(*errfunc) (filename, error-code)The argument filename is the name of the directory that
globcouldn't open or couldn't read, and error-code is the
errnovalue that was reported to
glob. If the error handler function returns nonzero, then
globgives up right away. Otherwise, it continues.
globreturns that there were no matches.)
GLOB_NOESCAPE, then `\' is an ordinary character.
globdoes its work by calling the function
fnmatchrepeatedly. It handles the flag
GLOB_NOESCAPEby turning on the
FNM_NOESCAPEflag in calls to
Go to the first, previous, next, last section, table of contents.