mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-23 05:44:41 +02:00
dos_findfirst() now uses split_path(). The only thing that needed to be
added was the need to check for "d:\" paths which return DE_NFILES. Also, findfirst("d:\nonexist\*.*",D_VOLID) should fail even if it actually searches in d:\. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1441 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
f7a9177b64
commit
60915d3cd0
@ -48,7 +48,7 @@ static BYTE *dosnamesRcsId =
|
|||||||
returns number of characters in the directory component (up to the
|
returns number of characters in the directory component (up to the
|
||||||
last backslash, including d:) or negative if error
|
last backslash, including d:) or negative if error
|
||||||
*/
|
*/
|
||||||
int ParseDosName(const char *filename, BOOL bAllowWildcards)
|
int ParseDosName(const char *filename)
|
||||||
{
|
{
|
||||||
int nDirCnt;
|
int nDirCnt;
|
||||||
const char *lpszLclDir, *lpszLclFile;
|
const char *lpszLclDir, *lpszLclFile;
|
||||||
@ -76,14 +76,7 @@ int ParseDosName(const char *filename, BOOL bAllowWildcards)
|
|||||||
++filename;
|
++filename;
|
||||||
|
|
||||||
if (filename == lpszLclFile)
|
if (filename == lpszLclFile)
|
||||||
{
|
return DE_PATHNOTFND;
|
||||||
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 nDirCnt;
|
return nDirCnt;
|
||||||
}
|
}
|
||||||
|
@ -282,8 +282,6 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name)
|
|||||||
{
|
{
|
||||||
REG f_node_ptr fnp;
|
REG f_node_ptr fnp;
|
||||||
REG dmatch *dmp = &sda_tmp_dm;
|
REG dmatch *dmp = &sda_tmp_dm;
|
||||||
REG COUNT i;
|
|
||||||
char *fname;
|
|
||||||
|
|
||||||
/* printf("ff %Fs\n", name);*/
|
/* 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 */
|
/* dirmatch structure and then for every find, we will open the */
|
||||||
/* current directory, do a seek and read. */
|
/* current directory, do a seek and read. */
|
||||||
|
|
||||||
/* Parse out the file name */
|
/* first: findfirst("D:\\") returns DE_NFILES */
|
||||||
i = ParseDosName(name, TRUE);
|
if (name[3] == '\0')
|
||||||
if (i < SUCCESS)
|
return DE_NFILES;
|
||||||
return i;
|
|
||||||
/*
|
/* Now open this directory so that we can read the */
|
||||||
printf("\nff %s", Tname);
|
/* fnode entry and do a match on it. */
|
||||||
printf("ff %s", fcbname);
|
if ((fnp = split_path(name, &fnode[0])) == NULL)
|
||||||
*/
|
return DE_PATHNOTFND;
|
||||||
|
|
||||||
/* Now search through the directory to find the entry... */
|
/* 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*/
|
/* RBIL: ignore ReaDONLY and ARCHIVE bits but DEVICE ignored too*/
|
||||||
/* For compatibility with bad search requests, only treat as */
|
/* For compatibility with bad search requests, only treat as */
|
||||||
/* volume search if only volume bit set, else ignore it. */
|
/* volume search if only volume bit set, else ignore it. */
|
||||||
fname = &name[i];
|
|
||||||
if ((attr & ~(D_RDONLY | D_ARCHIVE | D_DEVICE)) == D_VOLID)
|
if ((attr & ~(D_RDONLY | D_ARCHIVE | D_DEVICE)) == D_VOLID)
|
||||||
/* if ONLY label wanted redirect search to root dir */
|
/* 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 */
|
/* Now further initialize the dirmatch structure. */
|
||||||
/* 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);
|
|
||||||
dmp->dm_drive = name[0] - 'A';
|
dmp->dm_drive = name[0] - 'A';
|
||||||
dmp->dm_attr_srch = attr;
|
dmp->dm_attr_srch = attr;
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ BYTE *RcsId = "$Id$";
|
|||||||
/* */
|
/* */
|
||||||
STATIC f_node_ptr sft_to_fnode(int fd);
|
STATIC f_node_ptr sft_to_fnode(int fd);
|
||||||
STATIC void fnode_to_sft(f_node_ptr fnp);
|
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);
|
STATIC BOOL find_fname(f_node_ptr, int);
|
||||||
/* /// Added - Ron Cemer */
|
/* /// Added - Ron Cemer */
|
||||||
STATIC int merge_file_changes(f_node_ptr fnp, int collect);
|
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)
|
f_node_ptr split_path(char * path, f_node_ptr fnp)
|
||||||
{
|
{
|
||||||
/* Start off by parsing out the components. */
|
/* Start off by parsing out the components. */
|
||||||
int dirlength = ParseDosName(path, FALSE);
|
int dirlength = ParseDosName(path);
|
||||||
|
|
||||||
if (dirlength < SUCCESS)
|
if (dirlength < SUCCESS)
|
||||||
return (f_node_ptr) 0;
|
return (f_node_ptr) 0;
|
||||||
|
@ -130,7 +130,7 @@ VOID ASMCFUNC DosIdle_hlt(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* dosnames.c */
|
/* dosnames.c */
|
||||||
int ParseDosName(const char *, BOOL);
|
int ParseDosName(const char *);
|
||||||
|
|
||||||
/* error.c */
|
/* error.c */
|
||||||
VOID dump(void);
|
VOID dump(void);
|
||||||
@ -171,7 +171,7 @@ CLUSTER dos_free(struct dpb FAR * dpbp);
|
|||||||
BOOL dir_exists(char * path);
|
BOOL dir_exists(char * path);
|
||||||
VOID dpb16to32(struct dpb FAR *dpbp);
|
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);
|
int dos_cd(char * PathName);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user