Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
a810e41e
Commit
a810e41e
authored
Sep 25, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Sep 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Echo back command with whitespace removed first.
parent
2ff533c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+5
-0
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+7
-2
wcmdmain.c
programs/cmd/wcmdmain.c
+12
-5
No files found.
programs/cmd/tests/test_builtins.cmd
View file @
a810e41e
...
...
@@ -30,6 +30,9 @@ echo @tab@ on @space@
@echo off
echo off@tab@@space@
@echo noecho1
@echo noecho2
@@@@@echo echo3
echo ------------ Testing 'echo' [OFF] ------------
echo word
echo 'singlequotedword'
...
...
@@ -324,6 +327,8 @@ set VAR=
echo ------------ Testing variable substitution ------------
echo --- in FOR variables
for %%i in ("A B" C) do echo %%i
rem check works when prefix with @
@for %%i in ("A B" C) do echo %%i
rem quotes removal
for %%i in ("A B" C) do echo '%%~i'
rem fully qualified path
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
a810e41e
...
...
@@ -51,7 +51,7 @@ word@space@
@pwd@>echo word@space@@space@@space@
word@space@@space@
@
todo_wine@@
pwd@>echo word@space@
@pwd@>echo word@space@
word
@pwd@>echo@tab@word@space@
...
...
@@ -63,7 +63,7 @@ word@space@@tab@
@pwd@>echo@tab@word@tab@@space@@space@
word@tab@@space@
@
todo_wine@@
pwd@>echo word@space@
@pwd@>echo word@space@
word
@pwd@>echo@space@@tab@word@space@
...
...
@@ -76,6 +76,9 @@ word
@tab@word
@pwd@>echo @tab@ on @space@@space@
noecho1
noecho2
echo3
------------ Testing 'echo' [OFF] ------------
word
'singlequotedword'
...
...
@@ -282,6 +285,8 @@ r@or_broken@qwerty
--- in FOR variables
"A B"
C
"A B"
C
'A B'@or_broken@''
'C'@or_broken@''
@pwd@\C D@or_broken@%~ff
...
...
programs/cmd/wcmdmain.c
View file @
a810e41e
...
...
@@ -1819,27 +1819,34 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
/* Replace env vars if in a batch context */
if
(
context
)
handleExpansion
(
extraSpace
,
FALSE
,
NULL
,
NULL
);
/* Skip preceeding whitespace */
while
(
*
curPos
==
' '
||
*
curPos
==
'\t'
)
curPos
++
;
/* Show prompt before batch line IF echo is on and in batch program */
if
(
context
&&
echo_mode
&&
extraSpace
[
0
]
&&
(
extraSpace
[
0
]
!=
'@'
))
{
if
(
context
&&
echo_mode
&&
*
curPos
&&
(
*
curPos
!=
'@'
))
{
static
const
WCHAR
echoDot
[]
=
{
'e'
,
'c'
,
'h'
,
'o'
,
'.'
};
static
const
WCHAR
echoCol
[]
=
{
'e'
,
'c'
,
'h'
,
'o'
,
':'
};
const
DWORD
len
=
sizeof
(
echoDot
)
/
sizeof
(
echoDot
[
0
]);
DWORD
curr_size
=
strlenW
(
extraSpace
);
DWORD
curr_size
=
strlenW
(
curPos
);
DWORD
min_len
=
(
curr_size
<
len
?
curr_size
:
len
);
WCMD_show_prompt
();
WCMD_output_asis
(
extraSpace
);
WCMD_output_asis
(
curPos
);
/* I don't know why Windows puts a space here but it does */
/* Except for lines starting with 'echo.' or 'echo:'. Ask MS why */
if
(
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
extraSpace
,
min_len
,
echoDot
,
len
)
!=
CSTR_EQUAL
curPos
,
min_len
,
echoDot
,
len
)
!=
CSTR_EQUAL
&&
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
extraSpace
,
min_len
,
echoCol
,
len
)
!=
CSTR_EQUAL
)
curPos
,
min_len
,
echoCol
,
len
)
!=
CSTR_EQUAL
)
{
WCMD_output_asis
(
spaceW
);
}
WCMD_output_asis
(
newlineW
);
}
/* Skip repeated 'no echo' characters */
while
(
*
curPos
==
'@'
)
curPos
++
;
/* Start with an empty string, copying to the command string */
curStringLen
=
0
;
curRedirsLen
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment