Commit graph

860 commits

Author SHA1 Message Date
Eric Pouech 7e70824ed5 cmd: Introduce CMD_NODE structure.
This will allow to separate better the individual command to
be executed (CMD_COMMAND) from the chaining and I/O handling
of several commands (CMD_NODE).

This also renames CMD_LIST into CMD_COMMAND to fit in above
scheme.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-13 21:09:41 +02:00
Eric Pouech 508b3ac996 cmd: Remove malloc attribute from xrealloc.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-13 21:09:39 +02:00
Eric Pouech ae9bdbda3b cmd: Use CRT's popen instead of rewriting it.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-08 22:39:44 +02:00
Eric Pouech 93354bbd88 cmd: Introduce xrealloc helper.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-08 22:39:44 +02:00
Eric Pouech 76237079d1 cmd: No longer keep track of last element in command list.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-08 22:39:44 +02:00
Eric Pouech 371eda6c4c cmd: Consistenly use the same variable to identify current command.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-08 22:39:44 +02:00
Eric Pouech 6f0e9e5e4e cmd/tests: Test success/failure of commands.
The || and && operators to chain commands rely on the LHS command
to be successful (or unsucessful) to decide upon launching the RHS
command.

Unfortunately, success/failure is not always when errorlevel is
0 (non zero).

Some exmaples:
- if a redirection fails (eg. appending to a non existing file),
  the command (builtin/external) is always unsuccessful (and the
  error level is untouched,
- external command (when redirection is ok) is succesful when
  program exit code is zero,
- ditto for a call to a label inside the batch file, with
  the 'exit /b' parameter,
- it's way more complicated for builtins. Eg 'type' is unsuccessful
  on a non existing file, while 'dir' (on the same unexisting file)
  succeeds.

So start adding some tests about success / failure of some commands.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-07 22:49:45 +02:00
Eric Pouech 289c49ee21 cmd/tests: Test calling batch files named as builtin commands.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-07 22:49:45 +02:00
Eric Pouech 8bbd48bfd8 cmd/tests: Test delayed expansion with spaces in IF and FOR.
Based on a patch by Alex Henrie.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-07 22:49:45 +02:00
Eric Pouech 232f282585 cmd/tests: Test nested loop variables expansion.
Based on a patch by Dimitry Sokolov.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-07 22:49:45 +02:00
Eric Pouech 14bdf6e725 cmd/tests: Test using %%0-%%9 as loop variables.
Based on a test case from Dimitry Sokolov.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-05-07 22:49:45 +02:00
Eric Pouech 7f60584a90 cmd: Fix substring expansion for 'magic' variables.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56498
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-04-01 09:08:56 +02:00
Eric Pouech b868d82391 cmd: Add test for substring handling in 'magic' variable expansion.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-04-01 09:08:49 +02:00
Bernhard Übelacker c418771a43 cmd: Avoid execution if block misses closing brackets. 2024-02-12 23:02:02 +01:00
Bernhard Übelacker d7edf3e651 cmd: Handle lines with just spaces in bracket blocks.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51599
2024-02-12 23:02:02 +01:00
Alexandre Julliard 7ccb5df0fc makefiles: Always use the global SOURCES variable for .rc files. 2023-11-01 22:43:56 +01:00
Akihiro Sagawa 30e0deb70e cmd: Reset totals after trailer output.
Otherwise, sums are inherited between drives.
For instance, dir /s z:\tmp c:\windows\system32\drivers\etc shows
an incorrect summary for drive c.
2023-10-24 06:30:23 -05:00
Alexandre Julliard 2205218b24 makefiles: Always use the global SOURCES variable for .svg files. 2023-10-14 13:47:59 +02:00
Alex Henrie 8f28294434 cmd: Reset ignoreBracket when moving to the next line.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55528
2023-10-09 11:40:34 +02:00
Akihiro Sagawa ae8b7109f0 cmd: Always outputs leading zeros when listing file time information. 2023-09-26 21:35:21 +02:00
Akihiro Sagawa 2188e11e78 cmd/tests: Test file time stamp format. 2023-09-26 21:35:21 +02:00
Akihiro Sagawa 6800ab403e cmd/tests: Add dir built-in command test. 2023-09-26 21:35:21 +02:00
Eric Pouech 91cce00dba cmd: Better handle ctrl-c events.
cmd shouldn't terminate itself when user hits ctrl-c.
cmd should terminate the currently running CUI child it
waits for upon ctrl-c.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-09-06 12:05:49 +02:00
Alex Henrie 859d5e68dd cmd: Handle if exist with an empty string argument.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55505
2023-09-04 20:41:54 +02:00
Dmitry Sokolov 7e4715149a cmd: Fixed var substring in 'enableDelayedExpansion' mode.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55402
2023-08-25 22:52:42 +02:00
Akihiro Sagawa 322c175cf0 cmd: DIR command outputs free space for the path.
When the path contains a mountpoint on Unix or a junction point to
another drive on Windows, cmd.exe should show free space for the
path instead of the root of the drive.
2023-08-24 16:44:26 +02:00
Akihiro Sagawa 91de94ab99 cmd: Use towlower()/towupper() for WCHARs.
Found with Coccinelle.
2023-08-24 16:44:26 +02:00
Alex Henrie c27f8f72d1 cmd: Introduce an option_equals helper for WCMD_parse_forf_options. 2023-08-17 10:40:37 +02:00
Alex Henrie eba7092f0a cmd: Allow numbered redirects at the beginning of a line.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55124
2023-07-05 21:08:33 +02:00
Maarten De Braekeleer 5e2f9996ba cmd: Fix 'if exist' with a directory/ as a parameter.
'if exists' takes a parameter which can be directory, directory/,
directory/. directory\ or directory\. for example, and should equate
to true if the directory exists. The syntax directory\ is explicitly
rejected by FindFirstFile and hence was not working - look for this
specific case, and if found append a '.'.

Follow-up commit of bc9d68bcbe

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55130#add_comment
2023-06-26 16:44:17 +02:00
Liam Middlebrook 0911d462f9 cmd: Fix empty strings between PATH separators.
Previously if an empty string was encountered while parsing out PATH,
cmd.exe would ignore the rest of the PATH entirely.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55097
Signed-off-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
2023-06-21 18:25:48 +02:00
Liam Middlebrook 9aee47f7f6 cmd/tests: Add tests for PATH separator.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55097
Signed-off-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
2023-06-21 18:25:38 +02:00
Alex Henrie 5792785879 cmd: Use standard C functions for memory allocation. 2022-12-09 17:52:25 +01:00
Eric Pouech f2ca35bd80 cmd: Use OEM code page when reading a file.
Calling GetConsoleCP() when ReadConsoleW() fails (potentially indicating
that cmd.exe's instance isn't attached to a console) makes no sense.

In details, since GetConsoleCP() returns 0 when not attached to a console
to indicate error, we're in fact using CP_ACP.

So fallback explicitely to OEM CP (which is the default for CUI programs).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-25 18:09:57 +01:00
Eric Pouech 8f1febc430 cmd: Don't write outside of variable array.
GCC 12.2 rightfully complains about an out-of-founds array access.
This can possibly happen for unsupported variable names.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-14 13:13:02 +01:00
Arkadiusz Hiler 92e4cad8e0 cmd/tests: Make sure for /f doesn't loop infinitely on NULs. 2022-11-10 09:48:30 +01:00
Eric Pouech e1c37c21da cmd: Use CRT file I/O function inside 'for /F' handling.
This allows:
- to mimic native behavior when a stray '\0' is present in file
  (in 'FOR /F' execution, it's interpreted as an EOF marker)
  (prevents an infinite loop)
- supports (with /USEBACKQ) unicode output (if BOM is present)

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53386
2022-11-10 09:48:23 +01:00
Alex Henrie 212e319dce cmd: Use the wcsrev function instead of reimplementing it. 2022-11-04 19:23:55 +01:00
Alex Henrie 6ee8f819cf cmd: Remove inapplicable comment from WCMD_getfileowner. 2022-11-04 19:23:55 +01:00
Eric Pouech 7de36f8e98 cmd: Skip too long paths.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 22:02:56 +02:00
Eric Pouech 69f9480cde cmd: Test that read is successful before using its result.
There are cases where the read can fail (not attached to a console,
input stream mapped to /dev/null...)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 22:02:50 +02:00
Francois Gouget be11845852 cmd: Fix the spelling of a batch file comment.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-24 09:53:59 +01:00
Eric Pouech ec0e9b3b94 cmd/tests: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-17 09:07:07 +01:00
Eric Pouech 7f9b9df04f cmd: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-17 09:07:07 +01:00
Alexandre Julliard f0cd33c69e include: Add support for defining Win32 types as 'long' where possible.
Add -DWINE_NO_LONG_TYPES to modules that still have compilation
warnings with long types.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-27 20:38:22 +01:00
Eric Pouech 1d178982ae cmd/tests: Test paths that exceed MAX_PATH.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-25 20:50:50 +01:00
Eric Pouech 23817bb8d9 cmd: Bail out when full path name exceeds MAX_PATH.
This mimics native behavior and prevents buffer overflows.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-25 20:50:49 +01:00
Eric Pouech 535da77552 cmd: Don't crash on 'if exist' without parameter.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51598
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-20 17:51:54 +01:00
Alexandre Julliard a8a250cdbc cmd: Use the standard va_list instead of __ms_va_list.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 11:00:27 +02:00
Zhiyi Zhang efd98caef1 cmd: Pass size in bytes to RegQueryValueExW().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 11:22:26 +02:00
Alexandre Julliard 088a787a2c makefiles: Make -mno-cygwin the default.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Bernhard Übelacker 810de9d1a7 cmd: Load start.exe from the system directory.
Fixes cmd test in pure 64-bit wine.

Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 22:30:45 +02:00
Bernhard Übelacker 36cc3d4c9c cmd/tests: Add test for attrib without parameter.
Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-08 20:49:19 +02:00
Alex Henrie 14bbccf756 cmd: Fix capitalization of WCMD_ReadFile in comment.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-06 14:50:28 +02:00
Florian Eder 617d14bc12 cmd: Do not change errorlevel when setting environment variables.
Changes CMD to set its errorlevel to 0 only when the value of an environment variable
is set in in non-interactive / batch mode, retains the previous value otherwise.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47791
Signed-off-by: Florian Eder <others.meder@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-18 21:08:03 +02:00
Gijs Vermeulen 0bf71745f0 cmd: Use terminated strings.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48486
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-15 17:41:40 +02:00
Roman Pišl 2d6b0b67d9 cmd: Fix handling of brackets in if-set expressions on a single line.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50642
Signed-off-by: Roman Pišl <rpisl@seznam.cz>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-10 20:07:24 +01:00
Roman Pišl 6809e0599e cmd: Fix handling of nested if-for expressions on a single line.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50641
Signed-off-by: Roman Pišl <rpisl@seznam.cz>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-10 20:07:00 +01:00
Jacek Caban 2ecb871310 cmd: Don't use WCMD_is_console_handle.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:50:20 +01:00
Michael Stefaniuc 40ce3c5b60 cmd: Use wide-char string literals.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-30 21:36:12 +01:00
Michael Stefaniuc a158bf7e9c cmd: Use wide-char string literals in builtins.c.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-30 21:36:12 +01:00
Michael Stefaniuc 9fcb2b097c cmd: Inline some simple extern WCHAR strings.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-30 21:36:12 +01:00
Michael Stefaniuc 77fc01d39d cmd: Avoid casting a const away.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-30 21:36:12 +01:00
Damjan Jovanovic abe848f05f cmd.exe: Increase size of WCMD_HandleTildeModifiers() buffers to MAXSTRING.
Some buffers in WCMD_HandleTildeModifiers() are only of size MAX_PATH,
even though they handle strings that aren't necessarily
filenames. When changed to have size MAXSTRING, a stack overflow crash
with strings of size MAX_PATH stops happening.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42731
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-17 21:16:43 +01:00
Aaron Hill 8e54cad6a1 cmd: Set errorlevel to 0 when 'call' is invoked with an empty string.
Previously, invoking 'call' with an empty string would leave errorlevel
unchanged. Reset errorlevel to 0 to match the behavior of
the Windows 'cmd.exe'.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49982
Signed-off-by: Aaron Hill <aa1ronham@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-15 20:53:44 +02:00
Myah Caron d1790c984b cmd.exe: Don't prompt for move when non-interactive.
Based on a patch by Francesco Noferi.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48396
Signed-off-by: Myah Caron <qsniyg@protonmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-11 16:57:42 +02:00
Myah Caron 81fe7a2165 cmd.exe: Fix /Y flag for move builtin.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48397
Signed-off-by: Myah Caron <qsniyg@protonmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-11 16:57:42 +02:00
Francesco Noferi fc1bb9aff5 cmd.exe: Fix parsing of && between quotes.
Signed-off-by: Francesco Noferi <lolisamurai@tfwno.gf>
Signed-off-by: Myah Caron <qsniyg@protonmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-11 16:57:42 +02:00
Alexandre Julliard 88c34b39ed cmd: FormatMessage() now reports ERROR_NO_WORK_DONE error for empty string.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-13 22:07:31 +02:00
Gabriel Ivăncescu a19a770f96 cmd.exe: Don't treat explicit paths as a PATH search list.
For example, the explicit path "C:\some;path" is currently treated as if
the PATH environment variable is "C:\some;path" which is obviously wrong,
and searches for the directories "C:\some" and "path".

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-06 19:53:01 +02:00
Bernhard Übelacker c358de84c8 cmd/tests: Test that the if command is not influenced by a previous one.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47770
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48738
Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-04 12:55:13 +02:00
Bernhard Übelacker b1e91a36a7 cmd: Fix crash in if condition parsing.
Regression introduced in f238e846e7.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47770
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48738
Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-04 12:55:13 +02:00
Zebediah Figura 2e45fdb194 cmd: Ignore quotes when parsing command line parameters.
This fixes a hang in the WinTV 8.5 installer.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 11:32:07 +02:00
Zebediah Figura 16c938cb66 cmd: Fix the spelling of "tilde".
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 11:32:05 +02:00
Zebediah Figura 60b3db6b98 cmd: Use _wsplitpath() from msvcrt.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 11:32:03 +02:00
Brendan Shanks e8f16fcbcc cmd: Use RtlGetVersion to fix displayed Windows version on Win8.1 or 10 prefix.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:04 +02:00
Gijs Vermeulen e737aafa8e cmd: Use wide character string literals in directory.c.
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-25 19:26:17 +01:00
Gijs Vermeulen 5fd548fc9b cmd: Use wide character string literals in batch.c.
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-25 19:25:47 +01:00
Francois Gouget 040c435075 cmd: Avoid unneeded strlenW() calls.
Neither WCMD_give_help(), nor WCMD_setshow_default() are ever called
with a NULL pointer (notice how WCMD_skip_leading_spaces() already
assumes its argument is not NULL and does not return NULL).

Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-09 23:47:46 +01:00
Francois Gouget ecdc4daccf cmd: Fix the spelling of a WINE_TRACE() message and a comment.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-09 23:47:46 +01:00
Alexandre Julliard 5d48eac456 cmd: Environment variables contain signed numbers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-25 20:47:43 +01:00
Alexandre Julliard ed6a5e97e0 programs: Make all program entrypoints cdecl.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-17 17:05:47 +02:00
Bernhard Übelacker f238e846e7 cmd.exe: Change parsing of the if command to avoid parsing the operators.
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
Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-23 22:12:09 +02:00
Bernhard belacker 4684e1a9c6 cmd.exe: Command type with multiple files should print filenames to stderr.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46983
Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 20:04:40 +02:00
Damjan Jovanovic ada8b1ab93 cmd.exe: If there is a title given through STARTUPINFO, use it.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-19 22:16:46 +02:00
Alexandre Julliard 7f0272a59a cmd: Explicitly mark qsort() callback funtions cdecl.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 03:40:25 -05:00
Alexandre Julliard 43c430a6d8 cmd: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-03 16:30:39 +02:00
Isira Seneviratne f4d4fba14c cmd: Correct capitalization of "Windows Explorer".
Signed-off-by: Isira Seneviratne <isirasen96@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 19:28:19 +02:00
Michael Stefaniuc 02e4210265 cmd: Avoid using the comma operator.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 21:41:23 +01:00
Michael Stefaniuc 7857074700 cmd: Remove useless cast to self.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-14 23:53:14 +01:00
Alexander Coffin fc358a8275 cmd/tests: Add some tests for "choice".
Signed-off-by: Alexander Coffin <alexcoffin1999@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-26 15:34:11 +01:00
Alexandre Julliard 0e33105abb cmd/tests: Fix test failures on latest Windows 10.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-11 16:29:14 +01:00
Michael Stefaniuc 44bda237ed cmd: Avoid naming conflicts with the global HeapAlloc wrappers.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-26 12:21:39 +01:00
Michael Stefaniuc a46f311f3f cmd: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-30 00:10:14 +01:00
Dmitry Timoshkov 7edfcd63ad kernel32: MoveFile(source, source) should succeed.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-15 20:13:50 +02:00
Francois Gouget 99fdd9e61c cmd: A spelling fix in a comment.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-14 19:10:17 +02:00
Jason Edmeades f87e25a7bc cmd: Handle unechoed rem commands inside a (..) section.
When processing a (..) multiline section, each line is processed and
if it starts with a '@' it is not echoed, but more importantly if is
'rem' then anything else on that line should be ignored. The reported
issue was that a pipe was being executed when it was hidden behind a
rem, which was trigged by the preceeding '@' character not being
skipped.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45729
Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 19:11:36 +02:00
Jason Edmeades 1a7333bec6 cmd: Handle "for" loop handling of tokens, where * does not follow a number.
With the 'for' loop /f syntax, if tokens are requested the the normal
syntax is something like tokens=1,2* but there is valid syntax like
1,2,* (which effectively means the same). Make this other syntax work.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45722
Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 19:11:17 +02:00
Jason Edmeades becfbb80b4 cmd: Handle whitespace in 'for' argument items.
Avoid whitespace affecting the parsing of a for loops items. The
leading and trailing quote or backtick needed removing, and it was
assumed that the trailing character would be that character, which was
wrong when there was whitespace unless the parameter is trimmed.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45731
Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 19:10:51 +02:00
Qian Hong 279ac253e5 kernel32: Fallback to default comspec when %COMSPEC% is not set.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=19801
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-03 19:44:43 +02:00