Martin Rottensteiner (2005only@pianonote.at):

- set errorlevel to 9009 if command not found
- implemented exit /b # in batchfiles

svn path=/trunk/; revision=16209
This commit is contained in:
Maarten Bosma 2005-06-21 19:17:49 +00:00
parent 8e3623c1af
commit c9d742f6cf
3 changed files with 18 additions and 5 deletions

View file

@ -119,12 +119,14 @@ VOID error_too_many_parameters (LPTSTR s)
VOID error_path_not_found (VOID)
{
ConErrResPuts(STRING_ERROR_PATH_NOT_FOUND);
nErrorLevel = 1;
}
VOID error_file_not_found (VOID)
{
ConErrResPuts(STRING_ERROR_FILE_NOT_FOUND);
nErrorLevel = 1;
}
@ -152,6 +154,7 @@ VOID error_invalid_drive (VOID)
VOID error_bad_command (VOID)
{
ConErrResPuts(STRING_ERROR_BADCOMMAND);
nErrorLevel = 9009;
}

View file

@ -130,7 +130,7 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
while (_istdigit (*pp))
n = n * 10 + (*pp++ - _T('0'));
x_flag ^= (nErrorLevel < n) ? 0 : X_EXEC;
x_flag ^= (nErrorLevel != n) ? 0 : X_EXEC;
x_flag |= X_EMPTY; /* Syntax error if comd empty */
}

View file

@ -482,15 +482,25 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
INT CommandExit (LPTSTR cmd, LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutResPuts(STRING_EXIT_HELP);
return 0;
if (bc != NULL && _tcsnicmp(param,_T("/b"),2) == 0)
{
param += 2;
while (_istspace (*param))
param++;
if (_istdigit(*param))
nErrorLevel = _ttoi(param);
ExitBatch (NULL);
}
else
bExit = TRUE;
bExit = TRUE;
return 0;
}
}
#ifdef INCLUDE_CMD_REM
/*