cmd: Fix IF operands parsing for '==' operator.

This commit is contained in:
Frédéric Delanoy 2011-09-06 19:19:44 +02:00 committed by Alexandre Julliard
parent 3627c28958
commit 712276c7bf
2 changed files with 14 additions and 5 deletions

View File

@ -1525,9 +1525,18 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
WCMD_parameter(p, 2+negate, &command, NULL);
}
else if ((s = strstrW (p, eqeqW))) {
/* We need to get potential surrounding double quotes, so param1/2 can't be used */
WCHAR *leftPart, *leftPartEnd, *rightPart, *rightPartEnd;
s += 2;
test = caseInsensitive ? (!lstrcmpiW(condition, WCMD_parameter(s, 0, NULL, NULL)))
: (!lstrcmpW (condition, WCMD_parameter(s, 0, NULL, NULL)));
WCMD_parameter(p, 0+negate+caseInsensitive, &leftPart, &leftPartEnd);
WCMD_parameter(p, 1+negate+caseInsensitive, &rightPart, &rightPartEnd);
test = caseInsensitive
? (CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
leftPart, leftPartEnd-leftPart+1,
rightPart, rightPartEnd-rightPart+1) == CSTR_EQUAL)
: (CompareStringW(LOCALE_SYSTEM_DEFAULT, 0,
leftPart, leftPartEnd-leftPart+1,
rightPart, rightPartEnd-rightPart+1) == CSTR_EQUAL);
WCMD_parameter(s, 1, &command, NULL);
}
else {

View File

@ -382,15 +382,15 @@ NUL
if/else should work with blocks
if seems to work
else seems to work
@todo_wine@if seems not to detect /c as parameter
if seems not to detect /c as parameter
Testing case sensitivity with and without /i option
if seems to default to case sensitivity
if /i seems to work
if /I seems to work
Testing string comparisons
equal
@todo_wine@non equal
@todo_wine@non equal
non equal
non equal
equal
Testing tabs handling
doom