2 * ECHO.C - internal echo commands.
7 * 16 Jul 1998 (Hans B Pufal)
10 * 16 Jul 1998 (John P Price)
11 * Separated commands into individual files.
13 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
14 * Added config.h include
16 * 08-Dec-1998 (Eric Kohl)
17 * Added help text ("/?").
19 * 19-Jan-1999 (Eric Kohl)
20 * Unicode and redirection ready!
22 * 13-Jul-2000 (Eric Kohl)
23 * Implemented 'echo.' and 'echoerr.'.
25 * 28-Apr-2005 (Magnus Olsen <magnus@greatlord.com>)
26 * Remove all hardcoded strings in En.rc
32 OnOffCommand(LPTSTR param
, LPBOOL flag
, INT message
)
35 if (_tcsnicmp(param
, D_OFF
, sizeof(D_OFF
)/sizeof(TCHAR
) - 1) == 0)
37 p2
= param
+ sizeof(D_OFF
)/sizeof(TCHAR
) - 1;
38 while (_istspace(*p2
))
46 else if (_tcsnicmp(param
, D_ON
, sizeof(D_ON
)/sizeof(TCHAR
) - 1) == 0)
48 p2
= param
+ sizeof(D_ON
)/sizeof(TCHAR
) - 1;
49 while (_istspace(*p2
))
57 else if (*param
== _T('\0'))
59 ConOutResPrintf(message
, *flag
? D_ON
: D_OFF
);
65 INT
CommandEcho (LPTSTR param
)
69 TRACE ("CommandEcho: '%s'\n", debugstr_aw(param
));
71 /* skip all spaces for the check of '/?', 'ON' and 'OFF' */
76 if (!_tcsncmp (p1
, _T("/?"), 2))
78 ConOutResPaging(TRUE
,STRING_ECHO_HELP4
);
82 if (!OnOffCommand(p1
, &bEcho
, STRING_ECHO_HELP5
))
84 /* skip the first character */
85 ConOutPuts(param
+ 1);
91 INT
CommandEchos (LPTSTR param
)
93 TRACE ("CommandEchos: '%s'\n", debugstr_aw(param
));
95 if (!_tcsncmp (param
, _T("/?"), 2))
97 ConOutResPuts(STRING_ECHO_HELP1
);
101 ConOutPrintf (_T("%s"), param
);
106 INT
CommandEchoerr (LPTSTR param
)
108 TRACE ("CommandEchoerr: '%s'\n", debugstr_aw(param
));
110 if (!_tcsncmp (param
, _T("/?"), 2))
112 ConOutResPuts(STRING_ECHO_HELP2
);
121 INT
CommandEchoserr (LPTSTR param
)
123 TRACE ("CommandEchoserr: '%s'\n", debugstr_aw(param
));
125 if (!_tcsncmp (param
, _T("/?"), 2))
127 ConOutResPuts(STRING_ECHO_HELP3
);
131 ConErrPrintf (_T("%s"), param
);