fix one bug with cmd goto so WBAT will work bit more now. thx gasmann to
report it.
Modified: trunk/reactos/subsys/system/cmd/goto.c
_____
Modified: trunk/reactos/subsys/system/cmd/goto.c
--- trunk/reactos/subsys/system/cmd/goto.c 2005-07-20 15:56:24 UTC
(rev 16667)
+++ trunk/reactos/subsys/system/cmd/goto.c 2005-07-20 17:06:53 UTC
(rev 16668)
@@ -71,6 +71,7 @@
while (*tmp && !_istspace (*tmp))
tmp++;
*tmp = _T('\0');
+
/* set file pointer to the beginning of the batch file */
lNewPosHigh = 0;
@@ -78,26 +79,40 @@
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;
}
Show replies by date