From cf39f6646dd3d986fcda0eb872d7d9f5a721b5a6 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Fri, 1 Feb 2008 09:49:58 +0000 Subject: [PATCH] fix a bug in goto a stubs for setlocal and endlocal (our default is delayed expansion) svn path=/trunk/; revision=32073 --- reactos/base/shell/cmd/cmd.h | 3 +++ reactos/base/shell/cmd/cmd.rbuild | 1 + reactos/base/shell/cmd/cmdtable.c | 4 ++++ reactos/base/shell/cmd/goto.c | 5 +++-- reactos/base/shell/cmd/setlocal.c | 27 +++++++++++++++++++++++++++ 5 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 reactos/base/shell/cmd/setlocal.c diff --git a/reactos/base/shell/cmd/cmd.h b/reactos/base/shell/cmd/cmd.h index 051017491f4..55fe60994c2 100644 --- a/reactos/base/shell/cmd/cmd.h +++ b/reactos/base/shell/cmd/cmd.h @@ -361,6 +361,9 @@ INT CommandScreen (LPTSTR, LPTSTR); /* Prototypes for SET.C */ INT cmd_set (LPTSTR, LPTSTR); +/* Prototypes for SETLOCAL.C */ +INT cmd_setlocal (LPTSTR, LPTSTR); +INT cmd_endlocal (LPTSTR, LPTSTR); /* Prototypes for START.C */ INT cmd_start (LPTSTR, LPTSTR); diff --git a/reactos/base/shell/cmd/cmd.rbuild b/reactos/base/shell/cmd/cmd.rbuild index 8044a09cf00..4b56be9d41d 100644 --- a/reactos/base/shell/cmd/cmd.rbuild +++ b/reactos/base/shell/cmd/cmd.rbuild @@ -54,6 +54,7 @@ replace.c screen.c set.c + setlocal.c shift.c start.c strtoclr.c diff --git a/reactos/base/shell/cmd/cmdtable.c b/reactos/base/shell/cmd/cmdtable.c index e5b3198df97..2143d95fa15 100644 --- a/reactos/base/shell/cmd/cmdtable.c +++ b/reactos/base/shell/cmd/cmdtable.c @@ -100,6 +100,8 @@ COMMAND cmds[] = {_T("echoerr."), CMD_HIDE, CommandEchoerr}, {_T("echoserr"), 0, CommandEchoserr}, + {_T("endlocal"), 0, cmd_endlocal}, + #ifdef INCLUDE_CMD_DEL {_T("erase"), 0, CommandDelete}, #endif @@ -192,6 +194,8 @@ COMMAND cmds[] = {_T("set"), 0, cmd_set}, #endif + {_T("setlocal"), 0, cmd_setlocal}, + {_T("shift"), CMD_BATCHONLY, cmd_shift}, #ifdef INCLUDE_CMD_START diff --git a/reactos/base/shell/cmd/goto.c b/reactos/base/shell/cmd/goto.c index c55548859d4..8b663be140b 100644 --- a/reactos/base/shell/cmd/goto.c +++ b/reactos/base/shell/cmd/goto.c @@ -39,7 +39,7 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) { TCHAR szMsg[RC_STRING_MAX_SIZE]; - LPTSTR tmp; + LPTSTR tmp, tmp2; LONG lNewPosHigh = 0; #ifdef _DEBUG @@ -119,8 +119,9 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) pos++; } + tmp2 = param; /* use whole label name */ - if ((*tmp == _T(':')) && ((_tcsicmp (++tmp, param) == 0) || (_tcsicmp (tmp, ++param) == 0))) + if ((*tmp == _T(':')) && ((_tcsicmp (++tmp, param) == 0) || (_tcsicmp (tmp, ++tmp2) == 0))) return 0; } diff --git a/reactos/base/shell/cmd/setlocal.c b/reactos/base/shell/cmd/setlocal.c new file mode 100644 index 00000000000..d939d0c53ed --- /dev/null +++ b/reactos/base/shell/cmd/setlocal.c @@ -0,0 +1,27 @@ +/* + * GOTO.C - goto internal batch command. + * + * History: + * + * 1 Feb 2008 (Christoph von Wittich) + * started. +*/ + +#include + + +/* unimplemented */ + +/* our current default is delayedexpansion */ + +INT cmd_setlocal (LPTSTR cmd, LPTSTR param) +{ + return 0; +} + +/* endlocal doesn't take any params */ +INT cmd_endlocal (LPTSTR cmd, LPTSTR param) +{ + return 0; +} +