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_ALTDIRFUNC"))
25 #ifdef GLOB_ALTDIRFUNC
26 return GLOB_ALTDIRFUNC;
32 if (strEQ(name, "GLOB_BRACE"))
44 if (strEQ(name, "GLOB_ERR"))
50 if (strEQ(name, "GLOB_ERROR"))
68 if (strEQ(name, "GLOB_MARK"))
76 if (strEQ(name, "GLOB_NOCASE"))
82 if (strEQ(name, "GLOB_NOCHECK"))
88 if (strEQ(name, "GLOB_NOMAGIC"))
94 if (strEQ(name, "GLOB_NOSORT"))
100 if (strEQ(name, "GLOB_NOSPACE"))
112 if (strEQ(name, "GLOB_QUOTE"))
124 if (strEQ(name, "GLOB_TILDE"))
156 errfunc(const char *foo, int bar) {
157 return !(bar == ENOENT || bar == ENOTDIR);
161 MODULE = File::Glob PACKAGE = File::Glob
175 /* allow for optional flags argument */
177 flags = (int) SvIV(ST(1));
181 retval = bsd_glob(pattern, flags, errfunc, &pglob);
184 /* return any matches found */
185 EXTEND(sp, pglob.gl_pathc);
186 for (i = 0; i < pglob.gl_pathc; i++) {
187 /* printf("# bsd_glob: %s\n", pglob.gl_pathv[i]); */
188 tmp = sv_2mortal(newSVpvn(pglob.gl_pathv[i],
189 strlen(pglob.gl_pathv[i])));
195 bsd_globfree(&pglob);