From 368f39faad7ac92cf78f49e4325f0b3b943c1df4 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Wed, 20 Jul 2005 18:43:01 +0000 Subject: [PATCH] fix another bug in goto it is internel label :eof jump to end of the bat file svn path=/trunk/; revision=16670 --- reactos/subsys/system/cmd/goto.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/reactos/subsys/system/cmd/goto.c b/reactos/subsys/system/cmd/goto.c index fbd9cbf18b4..4db0767d3aa 100644 --- a/reactos/subsys/system/cmd/goto.c +++ b/reactos/subsys/system/cmd/goto.c @@ -75,7 +75,16 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) /* set file pointer to the beginning of the batch file */ lNewPosHigh = 0; - SetFilePointer (bc->hBatchFile, 0, &lNewPosHigh, FILE_BEGIN); + + /* jump to end of the file */ + if ( _tcsicmp( param, _T(":eof"))==0) + { + SetFilePointer (bc->hBatchFile, 0, &lNewPosHigh, FILE_END); + return 0; + } + + /* jump to begin of the file */ + SetFilePointer (bc->hBatchFile, 0, &lNewPosHigh, FILE_BEGIN); while (FileGetString (bc->hBatchFile, textline, sizeof(textline))) { @@ -105,11 +114,12 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) pos++; } + /* use whole label name */ if ((*tmp == _T(':')) && (_tcsicmp (++tmp, param) == 0)) return 0; } - + LoadString(CMD_ModuleHandle, STRING_GOTO_ERROR2, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, param); ExitBatch(NULL);