7 /* XXX: need some thread awareness */
8 static int GLOB_ERROR = 0;
11 constant(char *name, int arg)
14 if (strlen(name) <= 5)
18 if (strEQ(name, "GLOB_ABEND"))
24 if (strEQ(name, "GLOB_ALPHASORT"))
26 return GLOB_ALPHASORT;
30 if (strEQ(name, "GLOB_ALTDIRFUNC"))
31 #ifdef GLOB_ALTDIRFUNC
32 return GLOB_ALTDIRFUNC;
38 if (strEQ(name, "GLOB_BRACE"))
50 if (strEQ(name, "GLOB_ERR"))
56 if (strEQ(name, "GLOB_ERROR"))
72 if (strEQ(name, "GLOB_LIMIT"))
80 if (strEQ(name, "GLOB_MARK"))
88 if (strEQ(name, "GLOB_NOCASE"))
94 if (strEQ(name, "GLOB_NOCHECK"))
100 if (strEQ(name, "GLOB_NOMAGIC"))
106 if (strEQ(name, "GLOB_NOSORT"))
112 if (strEQ(name, "GLOB_NOSPACE"))
124 if (strEQ(name, "GLOB_QUOTE"))
136 if (strEQ(name, "GLOB_TILDE"))
168 errfunc(const char *foo, int bar) {
169 return !(bar == ENOENT || bar == ENOTDIR);
173 MODULE = File::Glob PACKAGE = File::Glob
187 /* allow for optional flags argument */
189 flags = (int) SvIV(ST(1));
193 retval = bsd_glob(pattern, flags, errfunc, &pglob);
196 /* return any matches found */
197 EXTEND(sp, pglob.gl_pathc);
198 for (i = 0; i < pglob.gl_pathc; i++) {
199 /* printf("# bsd_glob: %s\n", pglob.gl_pathv[i]); */
200 tmp = sv_2mortal(newSVpvn(pglob.gl_pathv[i],
201 strlen(pglob.gl_pathv[i])));
207 bsd_globfree(&pglob);