From 2e13f4640df3523a16fb920f8d07a05048d3d15f Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Wed, 20 Jul 2005 19:44:47 +0000 Subject: [PATCH] fix more cmd goto bugs. found labels bugs, and search label bugs, param bugs. now it should work fine svn path=/trunk/; revision=16671 --- reactos/subsys/system/cmd/goto.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/reactos/subsys/system/cmd/goto.c b/reactos/subsys/system/cmd/goto.c index 4db0767d3aa..e7768d91ea9 100644 --- a/reactos/subsys/system/cmd/goto.c +++ b/reactos/subsys/system/cmd/goto.c @@ -67,17 +67,16 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) } /* terminate label at first space char */ - tmp = param; - while (*tmp && !_istspace (*tmp)) - tmp++; - *tmp = _T('\0'); - - + tmp = param+1; + while (!_istcntrl (*tmp) && !_istspace (*tmp) && (*tmp != _T(':'))) + tmp++; + *(tmp) = _T('\0'); + /* set file pointer to the beginning of the batch file */ lNewPosHigh = 0; /* jump to end of the file */ - if ( _tcsicmp( param, _T(":eof"))==0) + if ( _tcsicmp( param, _T(":eof"))==0) { SetFilePointer (bc->hBatchFile, 0, &lNewPosHigh, FILE_END); return 0; @@ -95,7 +94,7 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) tmp = textline + _tcslen (textline) - 1; - while (_istcntrl (*tmp) || _istspace (*tmp)) + while (_istcntrl (*tmp) || _istspace (*tmp) || (*tmp == _T(':'))) tmp--; *(tmp + 1) = _T('\0'); @@ -112,9 +111,8 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) if (_istspace(tmp[pos])) tmp[pos]=_T('\0'); pos++; - } - - + } + /* use whole label name */ if ((*tmp == _T(':')) && (_tcsicmp (++tmp, param) == 0)) return 0;