Added echos, echoerr and echoserr commands.
[reactos.git] / rosapps / cmd / echo.c
1 /* $Id: echo.c,v 1.3 1999/10/03 22:15:33 ekohl Exp $
2 *
3 * ECHO.C - internal echo commands.
4 *
5 *
6 * History:
7 *
8 * 16 Jul 1998 (Hans B Pufal)
9 * Started.
10 *
11 * 16 Jul 1998 (John P Price)
12 * Separated commands into individual files.
13 *
14 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
15 * Added config.h include
16 *
17 * 08-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
18 * Added help text ("/?").
19 *
20 * 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
21 * Unicode and redirection ready!
22 */
23
24 #include "config.h"
25
26 #include <windows.h>
27 #include <tchar.h>
28 #include <string.h>
29
30 #include "cmd.h"
31 #include "batch.h"
32
33
34 INT CommandEcho (LPTSTR cmd, LPTSTR param)
35 {
36 #ifdef _DEBUG
37 DebugPrintf ("CommandEcho '%s' : '%s'\n", cmd, param);
38 #endif
39
40 if (!_tcsncmp (param, _T("/?"), 2))
41 {
42 ConOutPuts ("Displays a message or switches command echoing on or off.\n\n"
43 "ECHO [ON | OFF]\nECHO [message]\n\n"
44 "Type ECHO without a parameter to display the current ECHO setting.");
45 return 0;
46 }
47
48 if (_tcsicmp (param, D_OFF) == 0)
49 bEcho = FALSE;
50 else if (_tcsicmp (param, D_ON) == 0)
51 bEcho = TRUE;
52 else if (*param)
53 ConOutPuts (param);
54 else
55 ConOutPrintf (_T("ECHO is %s\n"), bEcho ? D_ON : D_OFF);
56
57 return 0;
58 }
59
60 INT CommandEchos (LPTSTR cmd, LPTSTR param)
61 {
62 #ifdef _DEBUG
63 DebugPrintf ("CommandEchos '%s' : '%s'\n", cmd, param);
64 #endif
65
66 if (!_tcsncmp (param, _T("/?"), 2))
67 {
68 ConOutPuts ("Display a messages without trailing carridge return and line feed.\n"
69 "\n"
70 "ECHOS message\n");
71 return 0;
72 }
73
74 if (*param)
75 ConOutPrintf ("%s", param);
76
77 return 0;
78 }
79
80
81 INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
82 {
83 #ifdef _DEBUG
84 DebugPrintf ("CommandEchoerr '%s' : '%s'\n", cmd, param);
85 #endif
86
87 if (!_tcsncmp (param, _T("/?"), 2))
88 {
89 ConOutPuts ("Displays a message to the standard error.\n"
90 "\n"
91 "ECHOERR message");
92 return 0;
93 }
94
95 if (*param)
96 ConErrPuts (param);
97
98 return 0;
99 }
100
101 INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
102 {
103 #ifdef _DEBUG
104 DebugPrintf ("CommandEchoserr '%s' : '%s'\n", cmd, param);
105 #endif
106
107 if (!_tcsncmp (param, _T("/?"), 2))
108 {
109 ConOutPuts ("Prints a messages to standard error output without trailing carridge return and line feed.\n"
110 "\n"
111 "ECHOSERR message\n");
112 return 0;
113 }
114
115 if (*param)
116 ConOutPrintf ("%s", param);
117
118 return 0;
119 }
120
121 /* EOF */