set right errorlevel for cd / chdir, left to do we do not have /d param that are new in win2k maby in older windows also

svn path=/trunk/; revision=16463
This commit is contained in:
Magnus Olsen 2005-07-06 20:15:36 +00:00
parent 721be9ec7b
commit 7ee590086a

View file

@ -172,6 +172,8 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
return 0;
}
nErrorLevel = 0;
/* The whole param string is our parameter these days. The only thing we do is eliminating every quotation mark */
/* Is it safe to change the characters param is pointing to? I presume it is, as there doesn't seem to be any
post-processing of it after the function call (what would that accomplish?) */
@ -258,13 +260,14 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
{
hSearch = FindFirstFile(dir, &FileData);
if (hSearch == INVALID_HANDLE_VALUE)
{
if (hSearch == INVALID_HANDLE_VALUE)
{
ConOutFormatMessage(GetLastError());
free (lpOldPath);
lpOldPath = NULL;
return 1;
}
free (lpOldPath);
lpOldPath = NULL;
nErrorLevel = 1;
return 1;
}
while (!fFinished)
@ -282,6 +285,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
ConOutFormatMessage(GetLastError());
free (lpOldPath);
lpOldPath = NULL;
nErrorLevel = 1;
return 1;
}
@ -293,6 +297,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
{
FindClose(hSearch);
ConOutFormatMessage(GetLastError());
nErrorLevel = 1;
free (lpOldPath);
lpOldPath = NULL;
return 1;
@ -301,6 +306,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
//ErrorMessage (GetLastError(), _T("CD"));
ConOutFormatMessage(GetLastError());
nErrorLevel = 1;
/* throw away current directory */
free (lpOldPath);