cmd: Implement 'echo/'.
This commit is contained in:
parent
21a14e9612
commit
1d09a35878
|
@ -1465,7 +1465,7 @@ void WCMD_echo (const WCHAR *args)
|
||||||
WCHAR *trimmed;
|
WCHAR *trimmed;
|
||||||
|
|
||||||
if ( args[0]==' ' || args[0]=='\t' || args[0]=='.'
|
if ( args[0]==' ' || args[0]=='\t' || args[0]=='.'
|
||||||
|| args[0]==':' || args[0]==';')
|
|| args[0]==':' || args[0]==';' || args[0]=='/')
|
||||||
args++;
|
args++;
|
||||||
|
|
||||||
trimmed = WCMD_strtrim(args);
|
trimmed = WCMD_strtrim(args);
|
||||||
|
@ -1473,7 +1473,7 @@ void WCMD_echo (const WCHAR *args)
|
||||||
|
|
||||||
count = strlenW(trimmed);
|
count = strlenW(trimmed);
|
||||||
if (count == 0 && origcommand[0]!='.' && origcommand[0]!=':'
|
if (count == 0 && origcommand[0]!='.' && origcommand[0]!=':'
|
||||||
&& origcommand[0]!=';') {
|
&& origcommand[0]!=';' && origcommand[0]!='/') {
|
||||||
if (echo_mode) WCMD_output (WCMD_LoadMessage(WCMD_ECHOPROMPT), onW);
|
if (echo_mode) WCMD_output (WCMD_LoadMessage(WCMD_ECHOPROMPT), onW);
|
||||||
else WCMD_output (WCMD_LoadMessage(WCMD_ECHOPROMPT), offW);
|
else WCMD_output (WCMD_LoadMessage(WCMD_ECHOPROMPT), offW);
|
||||||
heap_free(trimmed);
|
heap_free(trimmed);
|
||||||
|
|
|
@ -15,6 +15,10 @@ echo:
|
||||||
echo :
|
echo :
|
||||||
echo:word
|
echo:word
|
||||||
echo :word
|
echo :word
|
||||||
|
echo/
|
||||||
|
echo /
|
||||||
|
echo/word
|
||||||
|
echo /word
|
||||||
echo off now
|
echo off now
|
||||||
echo word@space@
|
echo word@space@
|
||||||
echo word@space@@space@
|
echo word@space@@space@
|
||||||
|
@ -47,6 +51,10 @@ echo:
|
||||||
echo :
|
echo :
|
||||||
echo:word
|
echo:word
|
||||||
echo :word
|
echo :word
|
||||||
|
echo/
|
||||||
|
echo /
|
||||||
|
echo/word
|
||||||
|
echo /word
|
||||||
echo on again
|
echo on again
|
||||||
echo word@space@
|
echo word@space@
|
||||||
echo word@space@@space@
|
echo word@space@@space@
|
||||||
|
|
|
@ -42,6 +42,18 @@ word
|
||||||
@pwd@>echo :word@space@
|
@pwd@>echo :word@space@
|
||||||
:word
|
:word
|
||||||
|
|
||||||
|
@pwd@>echo/
|
||||||
|
|
||||||
|
|
||||||
|
@pwd@>echo /@space@
|
||||||
|
/
|
||||||
|
|
||||||
|
@pwd@>echo/word
|
||||||
|
word
|
||||||
|
|
||||||
|
@pwd@>echo /word@space@
|
||||||
|
/word
|
||||||
|
|
||||||
@pwd@>echo off now@space@
|
@pwd@>echo off now@space@
|
||||||
off now
|
off now
|
||||||
|
|
||||||
|
@ -93,6 +105,10 @@ word
|
||||||
:
|
:
|
||||||
word
|
word
|
||||||
:word
|
:word
|
||||||
|
|
||||||
|
/
|
||||||
|
word
|
||||||
|
/word
|
||||||
on again
|
on again
|
||||||
word@space@
|
word@space@
|
||||||
word@space@@space@
|
word@space@@space@
|
||||||
|
|
|
@ -1853,17 +1853,20 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
|
||||||
if (context && echo_mode && *curPos && (*curPos != '@')) {
|
if (context && echo_mode && *curPos && (*curPos != '@')) {
|
||||||
static const WCHAR echoDot[] = {'e','c','h','o','.'};
|
static const WCHAR echoDot[] = {'e','c','h','o','.'};
|
||||||
static const WCHAR echoCol[] = {'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]);
|
const DWORD len = sizeof(echoDot)/sizeof(echoDot[0]);
|
||||||
DWORD curr_size = strlenW(curPos);
|
DWORD curr_size = strlenW(curPos);
|
||||||
DWORD min_len = (curr_size < len ? curr_size : len);
|
DWORD min_len = (curr_size < len ? curr_size : len);
|
||||||
WCMD_show_prompt();
|
WCMD_show_prompt();
|
||||||
WCMD_output_asis(curPos);
|
WCMD_output_asis(curPos);
|
||||||
/* I don't know why Windows puts a space here but it does */
|
/* 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,
|
if (CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
|
||||||
curPos, min_len, echoDot, len) != CSTR_EQUAL
|
curPos, min_len, echoDot, len) != CSTR_EQUAL
|
||||||
&& CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
|
&& 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);
|
WCMD_output_asis(spaceW);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue