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"))
74 if (strEQ(name, "GLOB_MARK"))
82 if (strEQ(name, "GLOB_NOCASE"))
88 if (strEQ(name, "GLOB_NOCHECK"))
94 if (strEQ(name, "GLOB_NOMAGIC"))
100 if (strEQ(name, "GLOB_NOSORT"))
106 if (strEQ(name, "GLOB_NOSPACE"))
118 if (strEQ(name, "GLOB_QUOTE"))
130 if (strEQ(name, "GLOB_TILDE"))
162 errfunc(const char *foo, int bar) {
163 return !(bar == ENOENT || bar == ENOTDIR);
167 MODULE = File::Glob PACKAGE = File::Glob
181 /* allow for optional flags argument */
183 flags = (int) SvIV(ST(1));
187 retval = bsd_glob(pattern, flags, errfunc, &pglob);
190 /* return any matches found */
191 EXTEND(sp, pglob.gl_pathc);
192 for (i = 0; i < pglob.gl_pathc; i++) {
193 /* printf("# bsd_glob: %s\n", pglob.gl_pathv[i]); */
194 tmp = sv_2mortal(newSVpvn(pglob.gl_pathv[i],
195 strlen(pglob.gl_pathv[i])));
201 bsd_globfree(&pglob);