ReactOS 0.4.16-dev-297-gc569aee
echo.c
Go to the documentation of this file.
1/*
2 * ECHO.C - internal echo commands.
3 *
4 *
5 * History:
6 *
7 * 16 Jul 1998 (Hans B Pufal)
8 * Started.
9 *
10 * 16 Jul 1998 (John P Price)
11 * Separated commands into individual files.
12 *
13 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
14 * Added config.h include
15 *
16 * 08-Dec-1998 (Eric Kohl)
17 * Added help text ("/?").
18 *
19 * 19-Jan-1999 (Eric Kohl)
20 * Unicode and redirection ready!
21 *
22 * 13-Jul-2000 (Eric Kohl)
23 * Implemented 'echo.' and 'echoerr.'.
24 *
25 * 28-Apr-2005 (Magnus Olsen <magnus@greatlord.com>)
26 * Remove all hardcoded strings in En.rc
27 */
28
29#include "precomp.h"
30
31BOOL
33{
34 TCHAR *p2;
35 if (_tcsnicmp(param, D_OFF, sizeof(D_OFF)/sizeof(TCHAR) - 1) == 0)
36 {
37 p2 = param + sizeof(D_OFF)/sizeof(TCHAR) - 1;
38 while (_istspace(*p2))
39 p2++;
40 if (*p2 == _T('\0'))
41 {
42 *flag = FALSE;
43 return TRUE;
44 }
45 }
46 else if (_tcsnicmp(param, D_ON, sizeof(D_ON)/sizeof(TCHAR) - 1) == 0)
47 {
48 p2 = param + sizeof(D_ON)/sizeof(TCHAR) - 1;
49 while (_istspace(*p2))
50 p2++;
51 if (*p2 == _T('\0'))
52 {
53 *flag = TRUE;
54 return TRUE;
55 }
56 }
57 else if (*param == _T('\0'))
58 {
60 return TRUE;
61 }
62 return FALSE;
63}
64
66{
67 LPTSTR p1;
68
69 TRACE ("CommandEcho: '%s'\n", debugstr_aw(param));
70
71 /* skip all spaces for the check of '/?', 'ON' and 'OFF' */
72 p1 = param;
73 while(_istspace(*p1))
74 p1++;
75
76 if (!_tcsncmp (p1, _T("/?"), 2))
77 {
79 return 0;
80 }
81
83 {
84 /* skip the first character */
85 ConOutPuts(param + 1);
86 ConOutChar(_T('\n'));
87 }
88 return 0;
89}
90
92{
93 TRACE ("CommandEchos: '%s'\n", debugstr_aw(param));
94
95 if (!_tcsncmp (param, _T("/?"), 2))
96 {
98 return 0;
99 }
100
101 ConOutPrintf (_T("%s"), param);
102 return 0;
103}
104
105
107{
108 TRACE ("CommandEchoerr: '%s'\n", debugstr_aw(param));
109
110 if (!_tcsncmp (param, _T("/?"), 2))
111 {
113 return 0;
114 }
115
117 return 0;
118}
119
120
122{
123 TRACE ("CommandEchoserr: '%s'\n", debugstr_aw(param));
124
125 if (!_tcsncmp (param, _T("/?"), 2))
126 {
128 return 0;
129 }
130
131 ConErrPrintf (_T("%s"), param);
132 return 0;
133}
134
135/* EOF */
BOOL bEcho
Definition: batch.c:73
#define D_OFF
Definition: cmd.h:41
#define D_ON
Definition: cmd.h:40
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
Definition: console.c:178
#define ConErrPrintf(szStr,...)
Definition: console.h:44
#define ConErrPuts(szStr)
Definition: console.h:32
#define ConOutPrintf(szStr,...)
Definition: console.h:41
#define ConOutPuts(szStr)
Definition: console.h:29
#define debugstr_aw
Definition: precomp.h:44
#define STRING_ECHO_HELP5
Definition: resource.h:125
#define STRING_ECHO_HELP1
Definition: resource.h:121
#define STRING_ECHO_HELP3
Definition: resource.h:123
#define STRING_ECHO_HELP4
Definition: resource.h:124
#define STRING_ECHO_HELP2
Definition: resource.h:122
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLfloat param
Definition: glext.h:5796
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
#define _istspace
Definition: tchar.h:1504
#define _tcsncmp
Definition: tchar.h:1428
VOID ConOutChar(TCHAR c)
Definition: util.c:233
#define ConOutResPrintf(uID,...)
Definition: replace.h:31
#define ConOutResPuts(uID)
Definition: replace.h:28
INT CommandEchoserr(LPTSTR param)
Definition: echo.c:121
INT CommandEchos(LPTSTR param)
Definition: echo.c:91
INT CommandEcho(LPTSTR param)
Definition: echo.c:65
INT CommandEchoerr(LPTSTR param)
Definition: echo.c:106
BOOL OnOffCommand(LPTSTR param, LPBOOL flag, INT message)
Definition: echo.c:32
#define TRACE(s)
Definition: solgame.cpp:4
Definition: tftpd.h:60
int32_t INT
Definition: typedefs.h:58
#define _T(x)
Definition: vfdio.h:22
BOOL * LPBOOL
Definition: windef.h:162
char TCHAR
Definition: xmlstorage.h:189
#define _tcsnicmp
Definition: xmlstorage.h:207
CHAR * LPTSTR
Definition: xmlstorage.h:192