version 1.14, 2005/11/29 03:11:59 |
version 1.17, 2006/11/24 19:46:58 |
Line 107 __RCSID("$NetBSD$"); |
|
Line 107 __RCSID("$NetBSD$"); |
|
#define SLASH '/' |
#define SLASH '/' |
#define COMMA ',' |
#define COMMA ',' |
|
|
#ifndef DEBUG |
#ifndef USE_8BIT_CHARS |
|
|
#define M_QUOTE 0x8000 |
#define M_QUOTE 0x8000 |
#define M_PROTECT 0x4000 |
#define M_PROTECT 0x4000 |
Line 118 typedef u_short Char; |
|
Line 118 typedef u_short Char; |
|
|
|
#else |
#else |
|
|
#define M_QUOTE 0x80 |
#define M_QUOTE (Char)0x80 |
#define M_PROTECT 0x40 |
#define M_PROTECT (Char)0x40 |
#define M_MASK 0xff |
#define M_MASK (Char)0xff |
#define M_ASCII 0x7f |
#define M_ASCII (Char)0x7f |
|
|
typedef char Char; |
typedef char Char; |
|
|
Line 460 glob0(pattern, pglob) |
|
Line 460 glob0(pattern, pglob) |
|
glob_t *pglob; |
glob_t *pglob; |
{ |
{ |
const Char *qpatnext; |
const Char *qpatnext; |
int c, error, oldpathc; |
int c, error; |
|
__gl_size_t oldpathc; |
Char *bufnext, patbuf[MAXPATHLEN+1]; |
Char *bufnext, patbuf[MAXPATHLEN+1]; |
size_t limit = 0; |
size_t limit = 0; |
|
|
Line 771 glob3(pathbuf, pathend, pathlim, pattern |
|
Line 772 glob3(pathbuf, pathend, pathlim, pattern |
|
|
|
|
|
/* |
/* |
* Extend the gl_pathv member of a glob_t structure to accomodate a new item, |
* Extend the gl_pathv member of a glob_t structure to accommodate a new item, |
* add the new item, and update gl_pathc. |
* add the new item, and update gl_pathc. |
* |
* |
* This assumes the BSD realloc, which only copies the block when its size |
* This assumes the BSD realloc, which only copies the block when its size |
Line 791 globextend(path, pglob, limit) |
|
Line 792 globextend(path, pglob, limit) |
|
size_t *limit; |
size_t *limit; |
{ |
{ |
char **pathv; |
char **pathv; |
int i; |
size_t i, newsize, len; |
size_t newsize, len; |
|
char *copy; |
char *copy; |
const Char *p; |
const Char *p; |
|
|
Line 808 globextend(path, pglob, limit) |
|
Line 808 globextend(path, pglob, limit) |
|
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { |
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { |
/* first time around -- clear initial gl_offs items */ |
/* first time around -- clear initial gl_offs items */ |
pathv += pglob->gl_offs; |
pathv += pglob->gl_offs; |
for (i = pglob->gl_offs; --i >= 0; ) |
for (i = pglob->gl_offs + 1; --i > 0; ) |
*--pathv = NULL; |
*--pathv = NULL; |
} |
} |
pglob->gl_pathv = pathv; |
pglob->gl_pathv = pathv; |
|
|
globfree(pglob) |
globfree(pglob) |
glob_t *pglob; |
glob_t *pglob; |
{ |
{ |
int i; |
size_t i; |
char **pp; |
char **pp; |
|
|
_DIAGASSERT(pglob != NULL); |
_DIAGASSERT(pglob != NULL); |