Commit 003bdf8e authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

cmd: Ignore trailing whitespace when using cd.

parent bb6b19ba
...@@ -2118,6 +2118,8 @@ void WCMD_setshow_default (const WCHAR *command) { ...@@ -2118,6 +2118,8 @@ void WCMD_setshow_default (const WCHAR *command) {
if (*command != '"') *pos++ = *command; if (*command != '"') *pos++ = *command;
command++; command++;
} }
while (pos > command && (*(pos-1) == ' ' || *(pos-1) == '\t'))
pos--;
*pos = 0x00; *pos = 0x00;
/* Search for appropriate directory */ /* Search for appropriate directory */
......
...@@ -103,8 +103,7 @@ type foo ...@@ -103,8 +103,7 @@ type foo
del foo del foo
echo food21>>foo echo food21>>foo
type foo type foo
cd .. cd .. & rd /s/q foobar
rd /s/q foobar
echo ------------ Testing ^^ escape character -------------- echo ------------ Testing ^^ escape character --------------
rem Using something like "echo foo^" asks for an additional char after a "More?" prompt on the following line; it's not possible to currently test that non-interactively rem Using something like "echo foo^" asks for an additional char after a "More?" prompt on the following line; it's not possible to currently test that non-interactively
...@@ -494,8 +493,7 @@ if exist foo ( ...@@ -494,8 +493,7 @@ if exist foo (
) else ( ) else (
echo *** echo ***
) )
cd .. cd .. & rd foobar
rd foobar
echo ------------ Testing if/else -------------- echo ------------ Testing if/else --------------
echo if/else should work with blocks echo if/else should work with blocks
...@@ -594,8 +592,7 @@ rem del tmp ...@@ -594,8 +592,7 @@ rem del tmp
rem for /d %%i in (*) do echo %%i>> tmp rem for /d %%i in (*) do echo %%i>> tmp
rem sort < tmp rem sort < tmp
rem del tmp rem del tmp
cd .. cd .. & rd /s/Q foobar
rd /s/Q foobar
echo ...for /L echo ...for /L
rem Some cases loop forever writing 0s, like e.g. (1,0,1), (1,a,3) or (a,b,c); those can't be tested here rem Some cases loop forever writing 0s, like e.g. (1,0,1), (1,a,3) or (a,b,c); those can't be tested here
for /L %%i in (1,2,0) do echo %%i for /L %%i in (1,2,0) do echo %%i
...@@ -899,8 +896,7 @@ if exist foo (echo foo created) else echo foo not created! ...@@ -899,8 +896,7 @@ if exist foo (echo foo created) else echo foo not created!
if exist bar (echo bar created) else echo bar not created! if exist bar (echo bar created) else echo bar not created!
if exist foobar (echo foobar created) else echo foobar not created! if exist foobar (echo foobar created) else echo foobar not created!
if exist bar\baz (echo bar\baz created) else echo bar\baz not created! if exist bar\baz (echo bar\baz created) else echo bar\baz not created!
cd .. cd .. & rd /s/q foobaz
rd /s/q foobaz
call :setError 0 call :setError 0
mkdir foo\* mkdir foo\*
echo mkdir foo\* errorlevel %ErrorLevel% echo mkdir foo\* errorlevel %ErrorLevel%
...@@ -970,8 +966,7 @@ if not exist foo (echo foo removed) else echo foo not removed! ...@@ -970,8 +966,7 @@ if not exist foo (echo foo removed) else echo foo not removed!
if not exist bar (echo bar removed) else echo bar not removed! if not exist bar (echo bar removed) else echo bar not removed!
if not exist foobar (echo foobar removed) else echo foobar not removed! if not exist foobar (echo foobar removed) else echo foobar not removed!
if not exist bar\baz (echo bar\baz removed) else echo bar\baz not removed! if not exist bar\baz (echo bar\baz removed) else echo bar\baz not removed!
cd .. cd .. & rd /s/q foobaz
rd /s/q foobaz
echo ------------ Testing attrib -------------- echo ------------ Testing attrib --------------
rem FIXME Add tests for archive, hidden and system attributes + mixed attributes modifications rem FIXME Add tests for archive, hidden and system attributes + mixed attributes modifications
...@@ -1000,8 +995,7 @@ if not exist foo ( ...@@ -1000,8 +995,7 @@ if not exist foo (
attrib -r foo attrib -r foo
del foo del foo
) )
cd .. cd .. & rd /s/q foobar
rd /s/q foobar
echo ... recursive behaviour echo ... recursive behaviour
mkdir foobar\baz & cd foobar mkdir foobar\baz & cd foobar
echo > level1 echo > level1
...@@ -1015,8 +1009,7 @@ attrib level1 ...@@ -1015,8 +1009,7 @@ attrib level1
attrib baz\level2 attrib baz\level2
echo > bar echo > bar
attrib bar attrib bar
cd .. cd .. & rd /s/q foobar
rd /s/q foobar
echo ... folders processing echo ... folders processing
mkdir foobar mkdir foobar
attrib foobar attrib foobar
...@@ -1031,8 +1024,7 @@ type baz\toto ...@@ -1031,8 +1024,7 @@ type baz\toto
echo > baz\lala echo > baz\lala
rem Oddly windows allows file creation in a read-only directory... rem Oddly windows allows file creation in a read-only directory...
if exist baz\lala (echo file created in read-only dir) else echo file not created if exist baz\lala (echo file created in read-only dir) else echo file not created
cd .. cd .. & rd /s/q foobar
rd /s/q foobar
echo ------------ Testing CALL -------------- echo ------------ Testing CALL --------------
mkdir foobar & cd foobar mkdir foobar & cd foobar
...@@ -1091,8 +1083,7 @@ echo %ErrorLevel% ...@@ -1091,8 +1083,7 @@ echo %ErrorLevel%
rem First look for programs in the path before trying a builtin rem First look for programs in the path before trying a builtin
echo echo non-builtin dir> dir.cmd echo echo non-builtin dir> dir.cmd
call dir /b call dir /b
cd .. cd .. & rd /s/q foobar
rd /s/q foobar
echo ------------ Testing setlocal/endlocal ------------ echo ------------ Testing setlocal/endlocal ------------
call :setError 0 call :setError 0
...@@ -1133,8 +1124,7 @@ set VAR=globalval ...@@ -1133,8 +1124,7 @@ set VAR=globalval
call test.cmd call test.cmd
echo %VAR% echo %VAR%
set VAR= set VAR=
cd .. cd .. & rd /q/s foobar
rd /q/s foobar
echo -----------Testing Errorlevel----------- echo -----------Testing Errorlevel-----------
rem WARNING: Do *not* add tests using ErrorLevel after this section rem WARNING: Do *not* add tests using ErrorLevel after this section
......
...@@ -300,7 +300,7 @@ foo ...@@ -300,7 +300,7 @@ foo
foo1 foo1
bar2@space@ bar2@space@
foo2 foo2
@todo_wine@foobar deleted foobar deleted
@todo_wine@...on success conditional && @todo_wine@...on success conditional &&
@todo_wine@foo3 not created @todo_wine@foo3 not created
bar4@space@ bar4@space@
...@@ -317,8 +317,8 @@ Current dir: @pwd@\foobar@or_broken@Current dir:@space@ ...@@ -317,8 +317,8 @@ Current dir: @pwd@\foobar@or_broken@Current dir:@space@
@pwd@ @pwd@
@pwd@\foobar @pwd@\foobar
@pwd@ @pwd@
@todo_wine@@pwd@ @pwd@
@todo_wine@@pwd@ @pwd@
@pwd@\foobar\bar bak @pwd@\foobar\bar bak
@pwd@\foobar\bar bak @pwd@\foobar\bar bak
@pwd@\foobar\bar bak @pwd@\foobar\bar bak
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment