Martin Rottensteiner (2005only(a)pianonote.at):
- set errorlevel to 9009 if command not found
- implemented exit /b # in batchfiles
Modified: trunk/reactos/subsys/system/cmd/error.c
Modified: trunk/reactos/subsys/system/cmd/if.c
Modified: trunk/reactos/subsys/system/cmd/internal.c
_____
Modified: trunk/reactos/subsys/system/cmd/error.c
--- trunk/reactos/subsys/system/cmd/error.c 2005-06-21 18:44:20 UTC
(rev 16208)
+++ trunk/reactos/subsys/system/cmd/error.c 2005-06-21 19:17:49 UTC
(rev 16209)
@@ -119,12 +119,14 @@
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_bad_command (VOID)
{
ConErrResPuts(STRING_ERROR_BADCOMMAND);
+ nErrorLevel = 9009;
}
_____
Modified: trunk/reactos/subsys/system/cmd/if.c
--- trunk/reactos/subsys/system/cmd/if.c 2005-06-21 18:44:20 UTC
(rev 16208)
+++ trunk/reactos/subsys/system/cmd/if.c 2005-06-21 19:17:49 UTC
(rev 16209)
@@ -130,7 +130,7 @@
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 */
}
_____
Modified: trunk/reactos/subsys/system/cmd/internal.c
--- trunk/reactos/subsys/system/cmd/internal.c 2005-06-21 18:44:20 UTC
(rev 16208)
+++ trunk/reactos/subsys/system/cmd/internal.c 2005-06-21 19:17:49 UTC
(rev 16209)
@@ -482,16 +482,26 @@
INT CommandExit (LPTSTR cmd, LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
+ ConOutResPuts(STRING_EXIT_HELP);
+
+ if (bc != NULL && _tcsnicmp(param,_T("/b"),2) == 0)
{
- ConOutResPuts(STRING_EXIT_HELP);
- return 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
/*
* does nothing
Show replies by date