diff --git a/kernel/dosnames.c b/kernel/dosnames.c index 5864588..a040d46 100644 --- a/kernel/dosnames.c +++ b/kernel/dosnames.c @@ -48,7 +48,7 @@ static BYTE *dosnamesRcsId = returns number of characters in the directory component (up to the last backslash, including d:) or negative if error */ -int ParseDosName(const char *filename, BOOL bAllowWildcards) +int ParseDosName(const char *filename) { int nDirCnt; const char *lpszLclDir, *lpszLclFile; @@ -76,14 +76,7 @@ int ParseDosName(const char *filename, BOOL bAllowWildcards) ++filename; if (filename == lpszLclFile) - { - int err = DE_PATHNOTFND; - if (bAllowWildcards && *filename == '\0' && - (nDirCnt == 3 || filename[-1] != '\\')) - /* D:\ or D:\DOS but not D:\DOS\ */ - err = DE_NFILES; - return err; - } + return DE_PATHNOTFND; return nDirCnt; } diff --git a/kernel/fatdir.c b/kernel/fatdir.c index d0c0559..1be57c1 100644 --- a/kernel/fatdir.c +++ b/kernel/fatdir.c @@ -282,8 +282,6 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name) { REG f_node_ptr fnp; REG dmatch *dmp = &sda_tmp_dm; - REG COUNT i; - char *fname; /* printf("ff %Fs\n", name);*/ @@ -294,14 +292,14 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name) /* dirmatch structure and then for every find, we will open the */ /* current directory, do a seek and read. */ - /* Parse out the file name */ - i = ParseDosName(name, TRUE); - if (i < SUCCESS) - return i; -/* - printf("\nff %s", Tname); - printf("ff %s", fcbname); -*/ + /* first: findfirst("D:\\") returns DE_NFILES */ + if (name[3] == '\0') + return DE_NFILES; + + /* Now open this directory so that we can read the */ + /* fnode entry and do a match on it. */ + if ((fnp = split_path(name, &fnode[0])) == NULL) + return DE_PATHNOTFND; /* Now search through the directory to find the entry... */ @@ -312,25 +310,11 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name) /* RBIL: ignore ReaDONLY and ARCHIVE bits but DEVICE ignored too*/ /* For compatibility with bad search requests, only treat as */ /* volume search if only volume bit set, else ignore it. */ - fname = &name[i]; if ((attr & ~(D_RDONLY | D_ARCHIVE | D_DEVICE)) == D_VOLID) /* if ONLY label wanted redirect search to root dir */ - i = 3; + dir_init_fnode(fnp, 0); - /* Now open this directory so that we can read the */ - /* fnode entry and do a match on it. */ - -/* printf("dir_open %s\n", szDirName);*/ - { - char tmp = name[i]; - name[i] = '\0'; - if ((fnp = dir_open(name, &fnode[0])) == NULL) - return DE_PATHNOTFND; - name[i] = tmp; - } - - /* Now initialize the dirmatch structure. */ - ConvertNameSZToName83(dmp->dm_name_pat, fname); + /* Now further initialize the dirmatch structure. */ dmp->dm_drive = name[0] - 'A'; dmp->dm_attr_srch = attr; diff --git a/kernel/fatfs.c b/kernel/fatfs.c index c5afbc9..f1fe74d 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -39,7 +39,6 @@ BYTE *RcsId = "$Id$"; /* */ STATIC f_node_ptr sft_to_fnode(int fd); STATIC void fnode_to_sft(f_node_ptr fnp); -STATIC f_node_ptr split_path(char *, f_node_ptr fnp); STATIC BOOL find_fname(f_node_ptr, int); /* /// Added - Ron Cemer */ STATIC int merge_file_changes(f_node_ptr fnp, int collect); @@ -258,7 +257,7 @@ COUNT dos_close(COUNT fd) f_node_ptr split_path(char * path, f_node_ptr fnp) { /* Start off by parsing out the components. */ - int dirlength = ParseDosName(path, FALSE); + int dirlength = ParseDosName(path); if (dirlength < SUCCESS) return (f_node_ptr) 0; diff --git a/kernel/proto.h b/kernel/proto.h index a336f5e..2c1a4d7 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -130,7 +130,7 @@ VOID ASMCFUNC DosIdle_hlt(void); #endif /* dosnames.c */ -int ParseDosName(const char *, BOOL); +int ParseDosName(const char *); /* error.c */ VOID dump(void); @@ -171,7 +171,7 @@ CLUSTER dos_free(struct dpb FAR * dpbp); BOOL dir_exists(char * path); VOID dpb16to32(struct dpb FAR *dpbp); -VOID trim_path(BYTE FAR * s); +f_node_ptr split_path(char *, f_node_ptr fnp); int dos_cd(char * PathName);