Fix a CD bug spotted by ravelo_. This is simlair to bug 690. cd
foo\"bar", cd "foo"\"bar"" and other of the sorts are
all valid.
Modified: trunk/reactos/subsys/system/cmd/internal.c
_____
Modified: trunk/reactos/subsys/system/cmd/internal.c
--- trunk/reactos/subsys/system/cmd/internal.c 2005-08-21 19:35:19 UTC
(rev 17468)
+++ trunk/reactos/subsys/system/cmd/internal.c 2005-08-21 20:44:47 UTC
(rev 17469)
@@ -315,19 +315,16 @@
/* Get Current Directory */
GetRootPath(_T("."),szCurrent,MAX_PATH);
- /* Remove " */
- if(szPath[0] == _T('\"'))
+ /* Remove " */
+ i = 0;
+ while(i < _tcslen(szPath))
{
- tmpPath = _tcsstr(szPath,_T("\""));
- tmpPath++;
- _tcscpy(szPath,tmpPath);
+ if(szPath[i] == _T('\"'))
+ memmove(&szPath[i],&szPath[i + 1],
_tcslen(&szPath[i]) * sizeof(TCHAR));
+ else
+ i++;
}
- if(szPath[_tcslen(szPath) - 1] == _T('\"'))
- {
- szPath[_tcslen(szPath) - 1] = _T('\0');
- }
-
tmpPath = szPath;
while (_istspace (*tmpPath))
tmpPath++;
@@ -339,7 +336,7 @@
return 0;
}
-
+
/* change to full path if relative path was given */
GetFullPathName(szPath,MAX_PATH,szFinalPath,NULL);
Show replies by date