diff --git a/reactos/subsys/system/cmd/goto.c b/reactos/subsys/system/cmd/goto.c index 8f2f042016e..fbd9cbf18b4 100644 --- a/reactos/subsys/system/cmd/goto.c +++ b/reactos/subsys/system/cmd/goto.c @@ -71,6 +71,7 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) while (*tmp && !_istspace (*tmp)) tmp++; *tmp = _T('\0'); + /* set file pointer to the beginning of the batch file */ lNewPosHigh = 0; @@ -78,26 +79,40 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param) while (FileGetString (bc->hBatchFile, textline, sizeof(textline))) { + int pos; + int size; + /* Strip out any trailing spaces or control chars */ tmp = textline + _tcslen (textline) - 1; - while (_istcntrl (*tmp) || _istspace (*tmp)) + + + while (_istcntrl (*tmp) || _istspace (*tmp)) tmp--; *(tmp + 1) = _T('\0'); - + /* Then leading spaces... */ - tmp = textline; + tmp = textline; while (_istspace (*tmp)) tmp++; - /* use only 1st 8 chars of label */ - if ((*tmp == _T(':')) && (_tcsncmp (++tmp, param, 8) == 0)) + /* All space after leading space terminate the string */ + size = _tcslen(tmp) -1; + pos=0; + while (tmp+pos < tmp+size) + { + if (_istspace(tmp[pos])) + tmp[pos]=_T('\0'); + 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); - return 1; }