2 * $Source: /cvs/cvsroot/d2x/arch/linux/findfile.c,v $
5 * $Date: 2001-10-19 07:39:25 $
7 * Linux findfile functions
9 * $Log: not supported by cvs2svn $
10 * Revision 1.3 2001/10/19 07:29:36 bradleyb
11 * Brought linux networking in line with d1x, moved some arch/linux_* stuff to arch/linux/
13 * Revision 1.2 2001/01/29 13:35:08 bradleyb
14 * Fixed build system, minor fixes
29 /* KLUDGE ALERT: evil globals */
31 static int glob_whichfile;
33 int FileFindFirst(char *search_str, FILEFINDSTRUCT *ffstruct)
38 Assert(search_str != NULL);
39 Assert(ffstruct != NULL);
41 r = glob(search_str, 0, NULL, &glob_a);
42 if (r == GLOB_NOMATCH) return -1;
46 t = strrchr(glob_a.gl_pathv[glob_whichfile], '/');
47 if (t == NULL) t = glob_a.gl_pathv[glob_whichfile]; else t++;
48 strncpy(ffstruct->name, t, 255);
49 ffstruct->size = strlen(ffstruct->name);
54 int FileFindNext(FILEFINDSTRUCT *ffstruct)
60 if (glob_whichfile >= glob_a.gl_pathc) return -1;
62 t = strrchr(glob_a.gl_pathv[glob_whichfile], '/');
63 if (t == NULL) t = glob_a.gl_pathv[glob_whichfile]; else t++;
64 strncpy(ffstruct->name, t, 255);
65 ffstruct->size = strlen(ffstruct->name);
69 int FileFindClose(void)