Commit Graph

180 Commits

Author SHA1 Message Date
Jason Edmeades 254dc78c2c cmd: Call and goto finds the next matching label.
A call or a goto will find the next matching label not the first one in the
file. This means it could be later in the file or it could be earlier in the
file, so make goto (which 'call' also uses) first scan from current file
position to the end of the file, and subsequently from the start of the file
to the wrap point.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42823
Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-05 11:38:13 +02:00
Jason Edmeades daee8b753c cmd: Support "c:<space>" etc when changing drive letters.
This allows whitespace and any other text on the line when changing drive letters.
Mostly I expect it crops up when commands are concatenated and the readability
whitespace is added to the end of the command. For example C: & dir results in
"C: " and "dir" as the two commands. We cannot unconditionally remove whitespace
as some commands rely on it.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40694
Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-05 11:29:44 +02:00
Jason Edmeades 15215bd071 cmd: Fix subdirectory prefix in for loops.
A for loop can be working through a wildcarded subdirectory, but when
processing the first file in the subdirectory, it stores the prefix in
a static variable which gets overwritten during the 'for' body
processing.

Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-25 21:44:48 +02:00
Jason Edmeades f53d57c854 cmd: Add support for wildcards in if exist.
Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-25 21:44:48 +02:00
Bernhard Übelacker f95b85a856 cmd: Avoid having first parameter to start.exe ignored.
Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-04-27 17:07:48 +02:00
Fabian Maurer e62000c5c0 cmd.exe: Parse parameters in "FOR /F" properly.
We must not remove the quotes from parameters, or strings like
"param=value" will get parsed incorrectly.

Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-07 22:22:53 +01:00
Lauri Kenttä 064508c0dd cmd: Fix copying when the dest is one of the sources.
"COPY a+b a" appends b to a.
"COPY a+b b" skips b from the sources.

Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-06 18:57:12 +01:00
Lauri Kenttä 29cb86a722 cmd/tests: Treat compressed file as broken in %~ai test.
Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-05 11:44:56 +01:00
Flávio J. Saraiva c0a5b1eab9 cmd/tests: Add tests for chaining rules of pipe and else.
Signed-off-by: Flávio J. Saraiva <flaviojs2005@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-11-29 12:22:36 +01:00
Flávio J. Saraiva df500b3a37 cmd/tests: Add test for chaining rules.
brackets precede '&&', '||' and '&'
'&&' precedes '||' and '&'
'||' precedes '&'
'a && b || c & d' is equivalent to '(((a && b) || c) & d)'

Signed-off-by: Flávio J. Saraiva <flaviojs2005@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-11-21 21:53:16 +01:00
Flávio J. Saraiva a4161801f3 cmd/tests: 'no echo' character with chains and brackets.
The @ character chains until we leave the current depth.
The @ character can be applied to brackets.

Signed-off-by: Flávio J. Saraiva <flaviojs2005@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-11-17 10:21:57 -06:00
Carlos Rafael Ramirez 55be713d76 cmd: When 'if' condition is not met, ignore the next commands in the list.
Signed-off-by: Carlos Rafael Ramirez <crramirez@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-11-01 20:32:56 +01:00
Piotr Caban f333bf47a8 ntdll: Keep drive letter size in RtlGetFullPathName_U when full path is specified.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-07-29 23:12:11 +09:00
Francois Gouget f90871cbfd cmd/tests: Slash spelling fix.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-03-28 16:26:54 +09:00
Sebastian Lackner c634f34aae cmd: Fix sharing permissions of piped output files.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-08 00:45:49 +09:00
Francois Gouget 50cb282c8c cmd/tests: Fix the %~a check on Windows >= 8.
Starting with Windows 8 %~a reports two new attributes, most likely to
match the new +X and +V attrib options (integrity and no_scrub_data
respectively).

Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-20 12:25:44 +09:00
Hugh McMaster 16cb9c4cb7 cmd: 'del' should set %errorlevel% to zero, not one, on error.
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-17 22:56:40 +09:00
Thomas Faller 1d09a35878 cmd: Implement 'echo/'. 2015-08-19 08:39:26 +09:00
Thomas Faller 3cda870469 cmd: Fix invalid "else if" execution. 2015-06-25 13:56:40 +09:00
Frédéric Delanoy e9eb86edfb cmd/tests: Don't use "@pwd@\" when expecting a full path. 2014-03-11 19:39:15 +01:00
Frédéric Delanoy f80dd2469f cmd/tests: Correctly determine script path for root directories. 2014-03-11 19:39:05 +01:00
Jason Edmeades a5b1172e90 cmd: Fix 'for' expansion of wildcards when no args are supplied. 2013-06-05 11:45:23 +02:00
Jason Edmeades 56a33a8c55 cmd: set "var=value" ignores trailing characters. 2013-06-05 11:45:19 +02:00
Jason Edmeades 2b9649d9db cmd: Fix tilda parameter expansion when arg is empty. 2013-06-04 21:01:13 +02:00
Jason Edmeades dc4dd0cb97 cmd: Fix handling of redundant information on goto/labels. 2013-06-04 21:01:13 +02:00
Jason Edmeades 0b00b717b9 cmd: Add beginnings of support for delayed expansion. 2013-01-07 11:15:23 +01:00
Ann and Jason Edmeades 95279b87e4 cmd: Add set /a support. 2012-12-21 12:00:19 +01:00
Jason Edmeades 51c4411a15 cmd: Add more tests for set /a. 2012-12-21 11:45:31 +01:00
Jason Edmeades 836f3e4c29 cmd: Convert the set /a tests to validate better. 2012-12-21 11:45:18 +01:00
Jason Edmeades d16f4e700b cmd: Add support for NUL in copy. 2012-11-20 11:53:15 +01:00
Jason Edmeades 2e92853091 cmd: Prevent external env vars causing tests to fail. 2012-11-20 11:53:10 +01:00
Jason Edmeades 47b35d5545 cmd: Add support for tokens= (for /f). 2012-11-20 11:46:40 +01:00
Frédéric Delanoy 250ce222b9 cmd/tests: Simplify 'if' comparison tests. 2012-11-07 11:57:51 +01:00
Jason Edmeades ae4571fb79 cmd: Fix for loops within for loops. 2012-11-06 16:02:41 +01:00
Jason Edmeades e26c2a5691 attrib: Add support for attrib /s. 2012-11-06 16:02:40 +01:00
Jason Edmeades 8e575940ad attrib: Support relative paths as args. 2012-11-06 16:02:39 +01:00
Jason Edmeades 7c3f3d09dd cmd: Don't overflow parameter length when copying substring. 2012-11-06 16:02:38 +01:00
Frédéric Delanoy 90c6f57fa9 cmd: Add support for GTR comparison operator in if statements. 2012-10-26 12:01:45 +02:00
Frédéric Delanoy 73995c71e0 cmd: Add support for GEQ comparison operator in if statements. 2012-10-26 12:01:40 +02:00
Frédéric Delanoy 80f8d49b07 cmd: Add support for NEQ comparison operator in if statements. 2012-10-26 12:01:36 +02:00
Frédéric Delanoy 14cd4151a9 cmd: Add support for EQU comparison operator in if statements. 2012-10-26 12:01:31 +02:00
Frédéric Delanoy 78af04f427 cmd: Add support for LEQ comparison operator in if statements. 2012-10-26 12:01:25 +02:00
Frédéric Delanoy 154710a093 cmd: Add support for LSS comparison operator in if statements. 2012-10-26 12:01:18 +02:00
Jason Edmeades 51b0d941d0 cmd: Add for /f delims= support. 2012-10-24 11:30:43 +02:00
Jason Edmeades a45301cb93 cmd: Strip quotes from for /f string before attempting to parse it. 2012-10-24 11:30:40 +02:00
Jason Edmeades 9171fd1454 cmd: Add support for usebackq (for /f). 2012-10-24 11:30:11 +02:00
Jason Edmeades 293da2d06c cmd: Implement support for for /f eol=c option. 2012-10-24 11:29:43 +02:00
Jason Edmeades d64298df99 cmd: Add support parsing for /f options and implement skip. 2012-10-24 11:29:06 +02:00
Frédéric Delanoy c5faceabd2 cmd/tests: Add tests for mixed number/stringified numbers comparisons in "if" statements. 2012-10-23 12:10:56 +02:00
Frédéric Delanoy 5888ad3537 cmd/tests: Add tests for GTR comparison operator in "if" statements. 2012-10-23 12:10:52 +02:00