2 * $Source: /cvs/cvsroot/d2x/arch/linux/findfile.c,v $
5 * $Date: 2001-10-19 07:29:36 $
7 * Linux findfile functions
9 * $Log: not supported by cvs2svn $
10 * Revision 1.2 2001/01/29 13:35:08 bradleyb
11 * Fixed build system, minor fixes
26 /* KLUDGE ALERT: evil globals */
28 static int glob_whichfile;
30 int FileFindFirst(char *search_str, FILEFINDSTRUCT *ffstruct)
35 Assert(search_str != NULL);
36 Assert(ffstruct != NULL);
38 r = glob(search_str, 0, NULL, &glob_a);
39 if (r == GLOB_NOMATCH) return -1;
43 t = strrchr(glob_a.gl_pathv[glob_whichfile], '/');
44 if (t == NULL) t = glob_a.gl_pathv[glob_whichfile]; else t++;
45 strncpy(ffstruct->name, t, 255);
46 ffstruct->size = strlen(ffstruct->name);
51 int FileFindNext(FILEFINDSTRUCT *ffstruct)
57 if (glob_whichfile >= glob_a.gl_pathc) return -1;
59 t = strrchr(glob_a.gl_pathv[glob_whichfile], '/');
60 if (t == NULL) t = glob_a.gl_pathv[glob_whichfile]; else t++;
61 strncpy(ffstruct->name, t, 255);
62 ffstruct->size = strlen(ffstruct->name);
66 int FileFindClose(void)