The invalid pathname character detection is moved from ParseDosName (dosnames.c)

to truename (newstuff.c), because TRUENAME should check these characters
before passing paths on to fatfs.c & fatdir.c.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1440 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2009-06-12 22:58:24 +00:00
parent c812a96e85
commit f7a9177b64
2 changed files with 9 additions and 48 deletions

View File

@ -37,33 +37,6 @@ static BYTE *dosnamesRcsId =
#include "globals.h"
const char _DirWildNameChars[] = "*?./\\\"[]:|<>+=;,";
#define PathSep(c) ((c)=='/'||(c)=='\\')
#define DriveChar(c) (((c)>='A'&&(c)<='Z')||((c)>='a'&&(c)<='z'))
#define DirChar(c) (((unsigned char)(c)) >= ' ' && \
!strchr(_DirWildNameChars+5, (c)))
#define WildChar(c) (((unsigned char)(c)) >= ' ' && \
!strchr(_DirWildNameChars+2, (c)))
#define NameChar(c) (((unsigned char)(c)) >= ' ' && \
!strchr(_DirWildNameChars, (c)))
VOID XlateLcase(BYTE * szFname, COUNT nChars);
VOID DosTrimPath(BYTE * lpszPathNamep);
/* Should be converted to a portable version after v1.0 is released. */
#if 0
VOID XlateLcase(BYTE * szFname, COUNT nChars)
{
while (nChars--)
{
if (*szFname >= 'a' && *szFname <= 'z')
*szFname -= ('a' - 'A');
++szFname;
}
}
#endif
/*
MSD durring an FindFirst search string looks like this;
(*), & (.) == Current directory *.*
@ -89,7 +62,7 @@ int ParseDosName(const char *filename, BOOL bAllowWildcards)
lpszLclDir = lpszLclFile = filename;
filename += 2;
while (DirChar(*filename))
while (*filename)
{
if (*filename == '\\')
lpszLclFile = filename + 1;
@ -99,8 +72,7 @@ int ParseDosName(const char *filename, BOOL bAllowWildcards)
/* Parse out the file name portion. */
filename = lpszLclFile;
while (bAllowWildcards ? WildChar(*filename) :
NameChar(*filename))
while (*filename)
++filename;
if (filename == lpszLclFile)
@ -113,23 +85,6 @@ int ParseDosName(const char *filename, BOOL bAllowWildcards)
return err;
}
/* Now we have pointers set to the directory portion and the */
/* file portion. Now determine the existance of an extension. */
if ('.' == *filename)
{
++filename;
while (*filename)
{
if (bAllowWildcards ? WildChar(*filename) :
NameChar(*filename))
++filename;
else
return DE_FILENOTFND;
}
}
else if (*filename)
return DE_FILENOTFND;
return nDirCnt;
}

View File

@ -242,6 +242,11 @@ long DosMkTmp(BYTE FAR * pathname, UWORD attr)
#define PNE_WILDCARD 1
#define PNE_DOT 2
STATIC const char _DirChars[] = "\"[]:|<>+=;,";
#define DirChar(c) (((unsigned char)(c)) >= ' ' && \
!strchr(_DirChars, (c)))
#define addChar(c) \
{ \
if (p >= dest + SFTMAX) PATH_ERROR; /* path too long */ \
@ -287,6 +292,7 @@ STATIC int parse_name_ext(int i, const char FAR **src, char **cp, char *dest)
default:
if (i) { /* name length in limits */
--i;
if (!DirChar(c)) PATH_ERROR;
addChar(c);
}
}