cmd.exe: Change parsing of the if command to avoid parsing the operators

System Internals / WINE - Bernhard Übelacker [mailbox.org] - 23 August 2019 20:12 EDT

Found while trying to look into bug 44236. A batch script is executed containing a line like this: if (%1)==(p) start /W " " "%SFDIR%WSFplot" wr2300.t35 3

This returns an error like this: Syntax error Can't recognize 'p' as an internal or external command, or batch script.

It looks like native does handle the brackets differently when contained inside the condition part of the if command.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44338

f238e846e7 cmd.exe: Change parsing of the if command to avoid parsing the operators.
programs/cmd/builtins.c | 79 +++++++++++++++++++-------------
programs/cmd/tests/test_builtins.cmd | 20 ++++++++
programs/cmd/tests/test_builtins.cmd.exp | 4 ++
programs/cmd/wcmd.h | 2 +
programs/cmd/wcmdmain.c | 30 ++++++++++--
5 files changed, 98 insertions(+), 37 deletions(-)

Upstream: source.winehq.org


  • Share