Need to define int fr_findfirst(char *path) and int fr_findnext() Base implementation: /* --------------------------------------------------------------------- */ #if !defined(_WIN32) #ifdef XFRACT static char searchdir[FILE_MAX_DIR]; static char searchname[FILE_MAX_PATH]; static char searchext[FILE_MAX_EXT]; static DIR *currdir = NULL; #endif int fr_findfirst(char *path) /* Find 1st file (or subdir) meeting path/filespec */ { #ifndef XFRACT union REGS regs; regs.h.ah = 0x1A; /* Set DTA to filedata */ regs.x.dx = (unsigned)&DTA; intdos(®s, ®s); regs.h.ah = 0x4E; /* Find 1st file meeting path */ regs.x.dx = (unsigned)path; regs.x.cx = FILEATTR; intdos(®s, ®s); return(regs.x.ax); /* Return error code */ #else if (currdir != NULL) { closedir(currdir); currdir = NULL; } splitpath(path,NULL,searchdir,searchname,searchext); if (searchdir[0]=='\0') { currdir = opendir("."); } else { currdir = opendir(searchdir); } if (currdir==NULL) { return -1; } else { return fr_findnext(); } #endif } int fr_findnext() /* Find next file (or subdir) meeting above path/filespec */ { #ifndef XFRACT union REGS regs; regs.h.ah = 0x4F; /* Find next file meeting path */ regs.x.dx = (unsigned)&DTA; intdos(®s, ®s); return(regs.x.ax); #else #ifdef DIRENT struct dirent *dirEntry; #else struct direct *dirEntry; #endif struct stat sbuf; char thisname[FILE_MAX_PATH]; char tmpname[FILE_MAX_PATH]; char thisext[FILE_MAX_EXT]; while (1) { dirEntry = readdir(currdir); if (dirEntry == NULL) { closedir(currdir); currdir = NULL; return -1; } else if (dirEntry->d_ino != 0) { splitpath(dirEntry->d_name,NULL,NULL,thisname,thisext); strncpy(DTA.filename,dirEntry->d_name,13); DTA.filename[12]='\0'; strcpy(tmpname,searchdir); strcat(tmpname,dirEntry->d_name); stat(tmpname,&sbuf); DTA.size = sbuf.st_size; if ((sbuf.st_mode&S_IFMT)==S_IFREG && (searchname[0]=='*' || strcmp(searchname,thisname)==0) && (searchext[0]=='*' || strcmp(searchext,thisext)==0)) { DTA.attribute = 0; return 0; } else if (((sbuf.st_mode&S_IFMT)==S_IFDIR) && ((searchname[0]=='*' || searchext[0]=='*') || (strcmp(searchname,thisname)==0))) { DTA.attribute = SUBDIR; return 0; } } } #endif } #endif /* !_WIN32 */