glob.c File Reference
`#include "system.h"`
`#include <stddef.h>`
`#include <assert.h>`
`#include <errno.h>`
Include dependency graph for glob.c:

Go to the source code of this file.

## Macros

#define | __alloca alloca
#define | __stat stat
#define | NAMLEN(_d) NLENGTH(_d)
#define | CONVERT_D_NAMLEN(d64, d32) (d64)->d_namlen = (d32)->d_namlen;
#define | CONVERT_D_INO(d64, d32) (d64)->d_ino = (d32)->d_ino;
#define | CONVERT_D_TYPE(d64, d32)
#define | CONVERT_DIRENT_DIRENT64(d64, d32)
#define | REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
#define | __set_errno(val) errno = (val)
#define | GLOB_INTERFACE_VERSION 1
#define | DIRSEP_CHAR '/'

## Functions

static const char *next_brace_sub | __P ((const char *begin))
static int glob_in_dir | __P ((const char *pattern, const char *directory, int flags, int(*errfunc)(const char *, int), glob_t *pglob))
static int prefix_array | __P ((const char *prefix, char **array, size_t n))
static int collated_compare | __P ((const __ptr_t, const __ptr_t))
static const char * | next_brace_sub (const char *begin)
static int | __glob_pattern_p (const char *pattern, int quote)
int | glob (const char *pattern, int flags, int(*errfunc) __P((const char *, int)), glob_t *pglob)
void | globfree (glob_t *pglob)
static int | collated_compare (const __ptr_t a, const __ptr_t b)
static int | prefix_array (const char *dirname, char **array, size_t n)
static int | glob_in_dir (const char *pattern, const char *directory, int flags, int(*errfunc) __P((const char *, int)), glob_t *pglob)

## Macro Definition Documentation

#define __alloca alloca

Definition at line 56 of file glob.c.

Referenced by glob(), and glob_in_dir().

#define __set_errno | ( |  | val | ) | errno = (val)

Definition at line 98 of file glob.c.

Referenced by glob(), and glob_in_dir().

#define __stat stat

Definition at line 57 of file glob.c.

Referenced by glob(), and glob_in_dir().

#define CONVERT_D_INO | ( |  | d64,
|  |  | d32
| ) |  | (d64)->d_ino = (d32)->d_ino;

Definition at line 71 of file glob.c.

#define CONVERT_D_NAMLEN | ( |  | d64,
|  |  | d32
| ) |  | (d64)->d_namlen = (d32)->d_namlen;

Definition at line 64 of file glob.c.

#define CONVERT_D_TYPE | ( |  | d64,
|  |  | d32
| ) |  |

Definition at line 79 of file glob.c.

#define CONVERT_DIRENT_DIRENT64 | ( |  | d64,
|  |  | d32
| ) |  |

Value:
memcpy ((d64)->d_name, (d32)->d_name, NAMLEN (d32) + 1); \
CONVERT_D_NAMLEN (d64, d32) \
CONVERT_D_INO (d64, d32) \
CONVERT_D_TYPE (d64, d32)

Definition at line 82 of file glob.c.

Referenced by glob_in_dir().

#define DIRSEP_CHAR '/'

Referenced by prefix_array().

#define GLOB_INTERFACE_VERSION 1

Definition at line 104 of file glob.c.

#define NAMLEN | ( |  | _d | ) | NLENGTH(_d)

Definition at line 58 of file glob.c.

Referenced by glob_in_dir().

#define REAL_DIR_ENTRY | ( |  | dp | ) | (dp->d_ino != 0)

Definition at line 93 of file glob.c.

Referenced by glob_in_dir().

## Function Documentation

static int __glob_pattern_p | ( | const char * | pattern,
|  | int | quote
| ) |  |

static

Definition at line 973 of file glob.c.

Referenced by glob(), and glob_in_dir().

static const char* next_brace_sub __P | ( | (const char *begin) |  | ) |

inline static

static int glob_in_dir __P | ( | (const char *pattern, const char *directory, int flags, int(*errfunc)(const char *, int), glob_t *pglob) |  | ) |

static

static int prefix_array __P | ( | (const char *prefix, char **array, size_t n) |  | ) |

static

static int collated_compare __P | ( | (const __ptr_t, const __ptr_t) |  | ) |

static

static int collated_compare | ( | const __ptr_t | a,
|  | const __ptr_t | b
| ) |  |

static

Definition at line 888 of file glob.c.

Referenced by glob().

int glob | ( | const char * | pattern,
|  | int | flags,
|  | int *errfunc | __P(const char *, int),
|  | glob_t * | pglob
| ) |  |

Definition at line 172 of file glob.c.

References __alloca, __GLOB_FLAGS, __glob_pattern_p(), __ptr_t, __set_errno, __stat, collated_compare(), errno, getenv(), glob_t::gl_closedir, glob_t::gl_flags, glob_t::gl_lstat, glob_t::gl_offs, glob_t::gl_opendir, glob_t::gl_pathc, glob_t::gl_pathv, glob_t::gl_readdir, glob_t::gl_stat, GLOB_ABORTED, GLOB_ALTDIRFUNC, GLOB_APPEND, GLOB_BRACE, GLOB_DOOFFS, GLOB_ERR, glob_in_dir(), GLOB_MAGCHAR, GLOB_MARK, GLOB_NOCHECK, GLOB_NOESCAPE, GLOB_NOMAGIC, GLOB_NOMATCH, GLOB_NOSORT, GLOB_NOSPACE, GLOB_ONLYDIR, GLOB_TILDE, GLOB_TILDE_CHECK, globfree(), name, next_brace_sub(), prefix_array(), xmalloc(), xrealloc(), and xstrdup().

Referenced by Glob().

static int glob_in_dir | ( | const char * | pattern,
|  | const char * | directory,
|  | int | flags,
|  | int *errfunc | __P(const char *, int),
|  | glob_t * | pglob
| ) |  |

static

Definition at line 1013 of file glob.c.

References __alloca, __glob_pattern_p(), __ptr_t, __set_errno, __stat, CONVERT_DIRENT_DIRENT64, dirent, DT_DIR, DT_UNKNOWN, errno, FNM_CASEFOLD, FNM_NOESCAPE, FNM_PERIOD, fnmatch(), glob_t::gl_closedir, glob_t::gl_flags, glob_t::gl_offs, glob_t::gl_opendir, glob_t::gl_pathc, glob_t::gl_pathv, glob_t::gl_readdir, glob_t::gl_stat, GLOB_ABORTED, GLOB_ALTDIRFUNC, GLOB_DOOFFS, GLOB_ERR, GLOB_MAGCHAR, GLOB_NOCHECK, GLOB_NOESCAPE, GLOB_NOMAGIC, GLOB_NOMATCH, GLOB_NOSPACE, GLOB_ONLYDIR, GLOB_PERIOD, name, NAMLEN, REAL_DIR_ENTRY, xmalloc(), and xrealloc().

Referenced by glob().

void globfree | ( | glob_t * | pglob | ) |

Definition at line 873 of file glob.c.

References __ptr_t, glob_t::gl_pathc, and glob_t::gl_pathv.

Referenced by glob(), and Globfree().

static const char* next_brace_sub | ( | const char * | begin | ) |

inline static

Definition at line 124 of file glob.c.

Referenced by glob().

static int prefix_array | ( | const char * | dirname,
|  | char ** | array,
|  | size_t | n
| ) |  |

static

Definition at line 908 of file glob.c.

References __ptr_t, DIRSEP_CHAR, and xmalloc().

Referenced by glob().