Fixed another path bug.

svn path=/trunk/; revision=466
This commit is contained in:
Eric Kohl 1999-05-14 13:32:13 +00:00
parent d2e0015ab7
commit 3ed33156f2
2 changed files with 20 additions and 9 deletions

View file

@ -315,6 +315,8 @@ DirReadParam (LPTSTR line, LPTSTR *param, LPDWORD lpFlags)
static VOID
ExtendFilespec (LPTSTR file)
{
INT len = 0;
if (!file)
return;
@ -330,7 +332,6 @@ ExtendFilespec (LPTSTR file)
{
memmove (&file[1], &file[0], (_tcslen (file) + 1) * sizeof(TCHAR));
file[0] = _T('*');
return;
}
/* if no . add .* */
@ -339,6 +340,14 @@ ExtendFilespec (LPTSTR file)
_tcscat (file, _T(".*"));
return;
}
/* if last character is '.' add '*' */
len = _tcslen (file);
if (file[len - 1] == _T('.'))
{
_tcscat (file, _T("*"));
return;
}
}
@ -1106,9 +1115,6 @@ INT cmd_dir (LPTSTR first, LPTSTR rest)
if (!param)
param = ".";
if (_tcschr (param, _T('/')))
param = _tcstok (param, _T("/"));
/* parse the directory info */
if (DirParsePathspec (param, szPath, szFilespec))
return 1;

View file

@ -315,6 +315,8 @@ DirReadParam (LPTSTR line, LPTSTR *param, LPDWORD lpFlags)
static VOID
ExtendFilespec (LPTSTR file)
{
INT len = 0;
if (!file)
return;
@ -330,7 +332,6 @@ ExtendFilespec (LPTSTR file)
{
memmove (&file[1], &file[0], (_tcslen (file) + 1) * sizeof(TCHAR));
file[0] = _T('*');
return;
}
/* if no . add .* */
@ -339,6 +340,14 @@ ExtendFilespec (LPTSTR file)
_tcscat (file, _T(".*"));
return;
}
/* if last character is '.' add '*' */
len = _tcslen (file);
if (file[len - 1] == _T('.'))
{
_tcscat (file, _T("*"));
return;
}
}
@ -408,7 +417,6 @@ DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec)
{
_tcscpy (szFilespec, start);
ExtendFilespec (szFilespec);
if (!GetCurrentDirectory (MAX_PATH, szPath))
{
szFilespec[0] = _T('\0');
@ -1106,9 +1114,6 @@ INT cmd_dir (LPTSTR first, LPTSTR rest)
if (!param)
param = ".";
if (_tcschr (param, _T('/')))
param = _tcstok (param, _T("/"));
/* parse the directory info */
if (DirParsePathspec (param, szPath, szFilespec))
return 1;