2000-07-19 06:58:13 +00:00
|
|
|
/* $Id: echo.c,v 1.4 2000/07/19 06:58:13 ekohl Exp $
|
1999-10-03 22:15:33 +00:00
|
|
|
*
|
|
|
|
* ECHO.C - internal echo commands.
|
1999-03-20 20:28:42 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* History:
|
|
|
|
*
|
|
|
|
* 16 Jul 1998 (Hans B Pufal)
|
|
|
|
* Started.
|
|
|
|
*
|
|
|
|
* 16 Jul 1998 (John P Price)
|
|
|
|
* Separated commands into individual files.
|
|
|
|
*
|
|
|
|
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
|
|
|
|
* Added config.h include
|
|
|
|
*
|
|
|
|
* 08-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
|
|
|
* Added help text ("/?").
|
|
|
|
*
|
|
|
|
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
|
|
|
* Unicode and redirection ready!
|
2000-07-19 06:58:13 +00:00
|
|
|
*
|
|
|
|
* 13-Jul-2000 (Eric Kohl <ekohl@rz-online.de>)
|
|
|
|
* Implemented 'echo.' and 'echoerr.'.
|
1999-03-20 20:28:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <tchar.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "cmd.h"
|
|
|
|
#include "batch.h"
|
|
|
|
|
|
|
|
|
1999-10-03 22:15:33 +00:00
|
|
|
INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
1999-03-20 20:28:42 +00:00
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
1999-10-03 22:15:33 +00:00
|
|
|
DebugPrintf ("CommandEcho '%s' : '%s'\n", cmd, param);
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!_tcsncmp (param, _T("/?"), 2))
|
|
|
|
{
|
2000-07-19 06:58:13 +00:00
|
|
|
ConOutPuts ("Displays a message or switches command echoing on or off.\n"
|
|
|
|
"\n"
|
|
|
|
" ECHO [ON | OFF]\n"
|
|
|
|
" ECHO [message]\n"
|
|
|
|
" ECHO. prints an empty line\n"
|
|
|
|
"\n"
|
|
|
|
"Type ECHO without a parameter to display the current ECHO setting.");
|
1999-03-20 20:28:42 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-07-19 06:58:13 +00:00
|
|
|
if (_tcsicmp (cmd, _T("echo.")) == 0)
|
|
|
|
{
|
|
|
|
if (param[0] == 0)
|
|
|
|
ConOutChar (_T('\n'));
|
|
|
|
else
|
|
|
|
ConOutPuts (param);
|
|
|
|
}
|
1999-03-20 20:28:42 +00:00
|
|
|
else
|
2000-07-19 06:58:13 +00:00
|
|
|
{
|
|
|
|
if (_tcsicmp (param, D_OFF) == 0)
|
|
|
|
bEcho = FALSE;
|
|
|
|
else if (_tcsicmp (param, D_ON) == 0)
|
|
|
|
bEcho = TRUE;
|
|
|
|
else if (*param)
|
|
|
|
ConOutPuts (param);
|
|
|
|
else
|
|
|
|
ConOutPrintf (_T("ECHO is %s\n"), bEcho ? D_ON : D_OFF);
|
|
|
|
}
|
1999-03-20 20:28:42 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
1999-10-03 22:15:33 +00:00
|
|
|
|
|
|
|
INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
|
|
|
DebugPrintf ("CommandEchos '%s' : '%s'\n", cmd, param);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!_tcsncmp (param, _T("/?"), 2))
|
|
|
|
{
|
|
|
|
ConOutPuts ("Display a messages without trailing carridge return and line feed.\n"
|
|
|
|
"\n"
|
2000-07-19 06:58:13 +00:00
|
|
|
" ECHOS message");
|
1999-10-03 22:15:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*param)
|
|
|
|
ConOutPrintf ("%s", param);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
|
|
|
DebugPrintf ("CommandEchoerr '%s' : '%s'\n", cmd, param);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!_tcsncmp (param, _T("/?"), 2))
|
|
|
|
{
|
|
|
|
ConOutPuts ("Displays a message to the standard error.\n"
|
|
|
|
"\n"
|
2000-07-19 06:58:13 +00:00
|
|
|
" ECHOERR message\n"
|
|
|
|
" ECHOERR. prints an empty line");
|
1999-10-03 22:15:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-07-19 06:58:13 +00:00
|
|
|
if (_tcsicmp (cmd, _T("echoerr.")) == 0)
|
|
|
|
{
|
|
|
|
if (param[0] == 0)
|
|
|
|
ConErrChar (_T('\n'));
|
|
|
|
else
|
|
|
|
ConErrPuts (param);
|
|
|
|
}
|
|
|
|
else if (*param)
|
|
|
|
{
|
1999-10-03 22:15:33 +00:00
|
|
|
ConErrPuts (param);
|
2000-07-19 06:58:13 +00:00
|
|
|
}
|
1999-10-03 22:15:33 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
|
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
|
|
|
DebugPrintf ("CommandEchoserr '%s' : '%s'\n", cmd, param);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!_tcsncmp (param, _T("/?"), 2))
|
|
|
|
{
|
|
|
|
ConOutPuts ("Prints a messages to standard error output without trailing carridge return and line feed.\n"
|
|
|
|
"\n"
|
2000-07-19 06:58:13 +00:00
|
|
|
" ECHOSERR message");
|
1999-10-03 22:15:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*param)
|
2000-07-19 06:58:13 +00:00
|
|
|
ConOutPrintf (_T("%s"), param);
|
1999-10-03 22:15:33 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|