mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 10:30:59 +00:00
Fix some pipe and revirt one erly change as harumt sugest. and add alot errorlevel most command handle the errorlevel right but it is alot work todo
svn path=/trunk/; revision=16652
This commit is contained in:
parent
6e7d8b2e8d
commit
7928f042c0
|
@ -113,7 +113,7 @@ AddAlias (LPTSTR name, LPTSTR subst)
|
|||
{
|
||||
s = (LPTSTR)malloc ((_tcslen (subst) + 1)*sizeof(TCHAR));
|
||||
if (!s)
|
||||
{
|
||||
{
|
||||
error_out_of_memory ();
|
||||
return;
|
||||
}
|
||||
|
@ -312,6 +312,8 @@ INT CommandAlias (LPTSTR cmd, LPTSTR param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
nErrorLevel = 0;
|
||||
|
||||
if (param[0] == _T('\0'))
|
||||
{
|
||||
PrintAlias ();
|
||||
|
|
|
@ -135,6 +135,7 @@ ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask,
|
|||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ErrorMessage (GetLastError (), pszFile);
|
||||
nErrorLevel = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -164,6 +165,7 @@ ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask,
|
|||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ErrorMessage (GetLastError (), pszFile);
|
||||
nErrorLevel = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -209,6 +211,8 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
nErrorLevel = 0;
|
||||
|
||||
/* build parameter array */
|
||||
arg = split (param, &argc, FALSE);
|
||||
|
||||
|
|
|
@ -1555,7 +1555,7 @@ int _main (int argc, char *argv[])
|
|||
OPEN_EXISTING, 0, NULL);
|
||||
if (GetConsoleScreenBufferInfo(hConsole, &Info) == FALSE)
|
||||
{
|
||||
ConOutFormatMessage(GetLastError());
|
||||
ConErrFormatMessage(GetLastError());
|
||||
return(1);
|
||||
}
|
||||
wColor = Info.wAttributes;
|
||||
|
|
|
@ -185,7 +185,7 @@ int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], int append, DWORD lpdwFl
|
|||
if (hFileDest == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle (hFileSrc);
|
||||
error_path_not_found ();
|
||||
ConOutResPuts(STRING_ERROR_PATH_NOT_FOUND);
|
||||
nErrorLevel = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], int append, DWORD lpdwFl
|
|||
{
|
||||
CloseHandle (hFileDest);
|
||||
CloseHandle (hFileSrc);
|
||||
error_out_of_memory ();
|
||||
ConOutResPuts(STRING_ERROR_OUT_OF_MEMORY);
|
||||
nErrorLevel = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -466,7 +466,9 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
default:
|
||||
/* invaild switch */
|
||||
error_invalid_switch(_totupper(arg[i][1]));
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_SWITCH, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, _totupper(arg[i][1]));
|
||||
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
@ -488,14 +490,15 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
|||
if(nFiles < 1)
|
||||
{
|
||||
/* There is not enough files, there has to be at least 1 */
|
||||
error_req_param_missing();
|
||||
ConOutResPuts(STRING_ERROR_REQ_PARAM_MISSING);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(nFiles > 2)
|
||||
{
|
||||
/* there is too many file names in command */
|
||||
error_too_many_parameters("");
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_TOO_MANY_PARAMETERS, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg,_T(""));
|
||||
nErrorLevel = 1;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
|||
if (dwErrorCode == ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
nErrorLevel = 1;
|
||||
|
||||
if (szFormat)
|
||||
{
|
||||
va_start (arg_ptr, szFormat);
|
||||
|
@ -49,14 +51,14 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
|||
NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR)&szError, 0, NULL))
|
||||
{
|
||||
ConOutPrintf (_T("%s %s\n"), szError, szMessage);
|
||||
ConErrPrintf (_T("%s %s\n"), szError, szMessage);
|
||||
LocalFree (szError);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, dwErrorCode);
|
||||
ConErrPrintf(szMsg, dwErrorCode);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -94,7 +96,8 @@ VOID error_parameter_format(TCHAR ch)
|
|||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_PARAMETERF_ERROR, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, ch);
|
||||
ConErrPrintf(szMsg, ch);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +106,8 @@ VOID error_invalid_switch (TCHAR ch)
|
|||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_SWITCH, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, ch);
|
||||
ConErrPrintf(szMsg, ch);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,20 +116,21 @@ VOID error_too_many_parameters (LPTSTR s)
|
|||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_TOO_MANY_PARAMETERS, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, s);
|
||||
ConErrPrintf(szMsg, s);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
VOID error_path_not_found (VOID)
|
||||
{
|
||||
ConOutResPuts(STRING_ERROR_PATH_NOT_FOUND);
|
||||
ConErrResPuts(STRING_ERROR_PATH_NOT_FOUND);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
VOID error_file_not_found (VOID)
|
||||
{
|
||||
ConOutResPuts(STRING_ERROR_FILE_NOT_FOUND);
|
||||
ConErrResPuts(STRING_ERROR_FILE_NOT_FOUND);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
@ -135,20 +140,22 @@ VOID error_sfile_not_found (LPTSTR f)
|
|||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_FILE_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(_T("%s - %s\n"), szMsg, f);
|
||||
ConErrPrintf(_T("%s - %s\n"), szMsg, f);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
VOID error_req_param_missing (VOID)
|
||||
{
|
||||
ConOutResPuts(STRING_ERROR_REQ_PARAM_MISSING);
|
||||
ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
VOID error_invalid_drive (VOID)
|
||||
{
|
||||
ConOutResPuts(STRING_ERROR_INVALID_DRIVE);
|
||||
ConErrResPuts(STRING_ERROR_INVALID_DRIVE);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,18 +169,21 @@ VOID error_bad_command (VOID)
|
|||
VOID error_no_pipe (VOID)
|
||||
{
|
||||
ConErrResPuts(STRING_ERROR_CANNOTPIPE);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
VOID error_out_of_memory (VOID)
|
||||
{
|
||||
ConErrResPuts(STRING_ERROR_OUT_OF_MEMORY);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
VOID error_invalid_parameter_format (LPTSTR s)
|
||||
{
|
||||
ConOutResPuts(STRING_ERROR_INVALID_PARAM_FORMAT);
|
||||
ConErrResPuts(STRING_ERROR_INVALID_PARAM_FORMAT);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,6 +197,8 @@ VOID error_syntax (LPTSTR s)
|
|||
ConErrPrintf(_T("%s - %s\n"), szMsg, s);
|
||||
else
|
||||
ConErrPrintf(_T("%s.\n"), szMsg);
|
||||
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue