Commit 1d09a358 authored by Thomas Faller's avatar Thomas Faller Committed by Alexandre Julliard

cmd: Implement 'echo/'.

parent 21a14e96
......@@ -1465,7 +1465,7 @@ void WCMD_echo (const WCHAR *args)
WCHAR *trimmed;
if ( args[0]==' ' || args[0]=='\t' || args[0]=='.'
|| args[0]==':' || args[0]==';')
|| args[0]==':' || args[0]==';' || args[0]=='/')
args++;
trimmed = WCMD_strtrim(args);
......@@ -1473,7 +1473,7 @@ void WCMD_echo (const WCHAR *args)
count = strlenW(trimmed);
if (count == 0 && origcommand[0]!='.' && origcommand[0]!=':'
&& origcommand[0]!=';') {
&& origcommand[0]!=';' && origcommand[0]!='/') {
if (echo_mode) WCMD_output (WCMD_LoadMessage(WCMD_ECHOPROMPT), onW);
else WCMD_output (WCMD_LoadMessage(WCMD_ECHOPROMPT), offW);
heap_free(trimmed);
......
......@@ -15,6 +15,10 @@ echo:
echo :
echo:word
echo :word
echo/
echo /
echo/word
echo /word
echo off now
echo word@space@
echo word@space@@space@
......@@ -47,6 +51,10 @@ echo:
echo :
echo:word
echo :word
echo/
echo /
echo/word
echo /word
echo on again
echo word@space@
echo word@space@@space@
......
......@@ -42,6 +42,18 @@ word
@pwd@>echo :word@space@
:word
@pwd@>echo/
@pwd@>echo /@space@
/
@pwd@>echo/word
word
@pwd@>echo /word@space@
/word
@pwd@>echo off now@space@
off now
......@@ -93,6 +105,10 @@ word
:
word
:word
/
word
/word
on again
word@space@
word@space@@space@
......
......@@ -1853,17 +1853,20 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
if (context && echo_mode && *curPos && (*curPos != '@')) {
static const WCHAR echoDot[] = {'e','c','h','o','.'};
static const WCHAR echoCol[] = {'e','c','h','o',':'};
static const WCHAR echoSlash[] = {'e','c','h','o','/'};
const DWORD len = sizeof(echoDot)/sizeof(echoDot[0]);
DWORD curr_size = strlenW(curPos);
DWORD min_len = (curr_size < len ? curr_size : len);
WCMD_show_prompt();
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 */
/* Except for lines starting with 'echo.', 'echo:' or 'echo/'. Ask MS why */
if (CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
curPos, min_len, echoDot, len) != CSTR_EQUAL
&& CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
curPos, min_len, echoCol, len) != CSTR_EQUAL)
curPos, min_len, echoCol, len) != CSTR_EQUAL
&& CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
curPos, min_len, echoSlash, len) != CSTR_EQUAL)
{
WCMD_output_asis(spaceW);
}
......
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