diff --git a/kernel/dosnames.c b/kernel/dosnames.c index f06b178..5864588 100644 --- a/kernel/dosnames.c +++ b/kernel/dosnames.c @@ -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 *.* @@ -88,8 +61,8 @@ int ParseDosName(const char *filename, BOOL bAllowWildcards) /* Now see how long a directory component we have. */ 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; } diff --git a/kernel/newstuff.c b/kernel/newstuff.c index 96fe4ea..3242396 100644 --- a/kernel/newstuff.c +++ b/kernel/newstuff.c @@ -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); } }