[CMD] GOTO: Fix label parsing.

We note two things, when CMD searches for the corresponding label in the
batch file:
- the first character of the line is always ignored, unless it's a colon;
- the escape caret ^ is supported and interpreted.

Fixes some cmd_winetests.
This commit is contained in:
Hermès Bélusca-Maïto
2020-07-22 01:16:53 +02:00
parent 71cd64d66a
commit 2e4c8c019e
4 changed files with 74 additions and 34 deletions

View File

@@ -131,7 +131,7 @@ static LPTSTR BatchParams(LPTSTR s1, LPTSTR s2)
BOOL inquotes = FALSE;
/* Find next parameter */
while (_istspace(*s2) || (*s2 && _tcschr(_T(",;="), *s2)))
while (_istspace(*s2) || (*s2 && _tcschr(STANDARD_SEPS, *s2)))
s2++;
if (!*s2)
break;
@@ -139,7 +139,7 @@ static LPTSTR BatchParams(LPTSTR s1, LPTSTR s2)
/* Copy it */
do
{
if (!inquotes && (_istspace(*s2) || _tcschr(_T(",;="), *s2)))
if (!inquotes && (_istspace(*s2) || _tcschr(STANDARD_SEPS, *s2)))
break;
inquotes ^= (*s2 == _T('"'));
*s1++ = *s2++;