Remove last hardcode string I have check the soure 3more time after I found some...
[reactos.git] / reactos / subsys / system / cmd / cmd.h
1 /*
2 * CMD.H - header file for the modules in CMD.EXE
3 *
4 *
5 * History:
6 *
7 * 7-15-95 Tim Norman
8 * started
9 *
10 * 06/29/98 (Rob Lake)
11 * Moved error messages in here
12 *
13 * 07/12/98 (Rob Lake)
14 * Moved more error messages here.
15 *
16 * 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
17 * Added compile date to version.
18 *
19 * 26-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
20 * Introduced a new version string.
21 * Thanks to Emanuele Aliberti!
22 */
23
24 #ifndef _CMD_H_INCLUDED_
25 #define _CMD_H_INCLUDED_
26
27 #include "config.h"
28
29 #include <windows.h>
30 #include <tchar.h>
31
32 #include "cmdver.h"
33
34 #define BREAK_BATCHFILE 1
35 #define BREAK_OUTOFBATCH 2
36 #define BREAK_INPUT 3
37 #define BREAK_IGNORE 4
38
39 /* define some error messages */
40
41 #define D_ON _T("on")
42 #define D_OFF _T("off")
43
44
45 /* command line buffer length */
46 #ifdef __REACTOS__
47 #define CMDLINE_LENGTH 512
48 #else
49 #define CMDLINE_LENGTH 8192
50 //#define CMDLINE_LENGTH 1024
51 #endif
52
53 /* global variables */
54 extern HANDLE hOut;
55 extern HANDLE hIn;
56 extern HANDLE hConsole;
57 extern WORD wColor;
58 extern WORD wDefColor;
59 extern BOOL bCtrlBreak;
60 extern BOOL bIgnoreEcho;
61 extern BOOL bExit;
62 extern INT nErrorLevel;
63 extern SHORT maxx;
64 extern SHORT maxy;
65 extern OSVERSIONINFO osvi;
66
67
68
69 /* Prototypes for ALIAS.C */
70 VOID InitializeAlias (VOID);
71 VOID DestroyAlias (VOID);
72 VOID ExpandAlias (LPTSTR, INT);
73 INT CommandAlias (LPTSTR, LPTSTR);
74
75
76 /* Prototypes for ATTRIB.C */
77 INT CommandAttrib (LPTSTR, LPTSTR);
78
79
80 /* Prototypes for BEEP.C */
81 INT cmd_beep (LPTSTR, LPTSTR);
82
83
84 /* Prototypes for CALL.C */
85 INT cmd_call (LPTSTR, LPTSTR);
86
87
88 /* Prototypes for CHCP.C */
89 INT CommandChcp (LPTSTR, LPTSTR);
90
91
92 /* Prototypes for CHOICE.C */
93 INT CommandChoice (LPTSTR, LPTSTR);
94
95
96 /* Prototypes for CLS.C */
97 INT cmd_cls (LPTSTR, LPTSTR);
98
99
100 /* Prototypes for CMD.C */
101 VOID ParseCommandLine (LPTSTR);
102 VOID AddBreakHandler (VOID);
103 VOID RemoveBreakHandler (VOID);
104
105 extern HANDLE CMD_ModuleHandle;
106
107
108 /* Prototypes for CMDINPUT.C */
109 VOID ReadCommand (LPTSTR, INT);
110
111
112 /* Prototypes for CMDTABLE.C */
113 #define CMD_SPECIAL 1
114 #define CMD_BATCHONLY 2
115 #define CMD_HIDE 4
116
117 typedef struct tagCOMMAND
118 {
119 LPTSTR name;
120 INT flags;
121 INT (*func) (LPTSTR, LPTSTR);
122 } COMMAND, *LPCOMMAND;
123
124 extern COMMAND cmds[]; /* The internal command table */
125
126 VOID PrintCommandList (VOID);
127
128
129 /* Prototypes for COLOR.C */
130 VOID SetScreenColor(WORD wArgColor, BOOL bFill);
131 INT CommandColor (LPTSTR, LPTSTR);
132
133
134 /* Prototypes for CONSOLE.C */
135 #ifdef _DEBUG
136 VOID DebugPrintf (LPTSTR, ...);
137 #endif /* _DEBUG */
138
139 VOID ConInDummy (VOID);
140 VOID ConInDisable (VOID);
141 VOID ConInEnable (VOID);
142 VOID ConInFlush (VOID);
143 VOID ConInKey (PINPUT_RECORD);
144 VOID ConInString (LPTSTR, DWORD);
145
146 VOID ConOutChar (TCHAR);
147 VOID ConOutPuts (LPTSTR);
148 VOID ConOutPrintf (LPTSTR, ...);
149 VOID ConErrChar (TCHAR);
150 VOID ConErrPuts (LPTSTR);
151 VOID ConErrPrintf (LPTSTR, ...);
152 VOID ConOutFormatMessage (DWORD MessageId, ...);
153
154 SHORT GetCursorX (VOID);
155 SHORT GetCursorY (VOID);
156 VOID GetCursorXY (PSHORT, PSHORT);
157 VOID SetCursorXY (SHORT, SHORT);
158
159 VOID GetScreenSize (PSHORT, PSHORT);
160 VOID SetCursorType (BOOL, BOOL);
161
162 VOID ConOutResPuts (UINT resID);
163 VOID ConErrResPuts (UINT resID);
164
165 /* Prototypes for COPY.C */
166 INT cmd_copy (LPTSTR, LPTSTR);
167
168
169 /* Prototypes for DATE.C */
170 INT cmd_date (LPTSTR, LPTSTR);
171
172
173 /* Prototypes for DEL.C */
174 INT CommandDelete (LPTSTR, LPTSTR);
175
176
177 /* Prototypes for DELAY.C */
178 INT CommandDelay (LPTSTR, LPTSTR);
179
180
181 /* Prototypes for DIR.C */
182 INT CommandDir (LPTSTR, LPTSTR);
183
184
185 /* Prototypes for DIRSTACK.C */
186 VOID InitDirectoryStack (VOID);
187 VOID DestroyDirectoryStack (VOID);
188 INT GetDirectoryStackDepth (VOID);
189 INT CommandPushd (LPTSTR, LPTSTR);
190 INT CommandPopd (LPTSTR, LPTSTR);
191 INT CommandDirs (LPTSTR, LPTSTR);
192
193
194 /* Prototypes for ECHO.C */
195 INT CommandEcho (LPTSTR, LPTSTR);
196 INT CommandEchos (LPTSTR, LPTSTR);
197 INT CommandEchoerr (LPTSTR, LPTSTR);
198 INT CommandEchoserr (LPTSTR, LPTSTR);
199
200
201 /* Prototypes for ERROR.C */
202 VOID ErrorMessage (DWORD, LPTSTR, ...);
203
204 VOID error_no_pipe (VOID);
205 VOID error_bad_command (VOID);
206 VOID error_invalid_drive (VOID);
207 VOID error_req_param_missing (VOID);
208 VOID error_sfile_not_found (LPTSTR);
209 VOID error_file_not_found (VOID);
210 VOID error_path_not_found (VOID);
211 VOID error_too_many_parameters (LPTSTR);
212 VOID error_parameter_format(TCHAR);
213 VOID error_invalid_switch (TCHAR);
214 VOID error_invalid_parameter_format (LPTSTR);
215 VOID error_out_of_memory (VOID);
216 VOID error_syntax (LPTSTR);
217
218 VOID msg_pause (VOID);
219
220
221 /* Prototypes for FILECOMP.C */
222 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
223 VOID CompleteFilename (LPTSTR, INT);
224 INT ShowCompletionMatches (LPTSTR, INT);
225 #endif
226 #ifdef FEATURE_4NT_FILENAME_COMPLETION
227 #endif
228
229
230 /* Prototypes for FOR.C */
231 INT cmd_for (LPTSTR, LPTSTR);
232
233
234 /* Prototypes for FREE.C */
235 INT CommandFree (LPTSTR, LPTSTR);
236
237
238 /* Prototypes for GOTO.C */
239 INT cmd_goto (LPTSTR, LPTSTR);
240
241
242 /* Prototypes for HISTORY.C */
243 #ifdef FEATURE_HISTORY
244 VOID History (INT, LPTSTR);/*add entries browse history*/
245 VOID History_move_to_bottom(VOID);/*F3*/
246 VOID InitHistory(VOID);
247 VOID CleanHistory(VOID);
248 VOID History_del_current_entry(LPTSTR str);/*CTRL-D*/
249 INT CommandHistory (LPTSTR cmd, LPTSTR param);
250 #endif
251
252
253 /* Prototypes for INTERNAL.C */
254 VOID InitLastPath (VOID);
255 VOID FreeLastPath (VOID);
256 INT cmd_chdir (LPTSTR, LPTSTR);
257 INT cmd_mkdir (LPTSTR, LPTSTR);
258 INT cmd_rmdir (LPTSTR, LPTSTR);
259 INT CommandExit (LPTSTR, LPTSTR);
260 INT CommandRem (LPTSTR, LPTSTR);
261 INT CommandShowCommands (LPTSTR, LPTSTR);
262
263
264 /* Prototypes for LABEL.C */
265 INT cmd_label (LPTSTR, LPTSTR);
266
267
268 /* Prototypes for LOCALE.C */
269 extern TCHAR cDateSeparator;
270 extern INT nDateFormat;
271 extern TCHAR cTimeSeparator;
272 extern INT nTimeFormat;
273 extern TCHAR cThousandSeparator;
274 extern TCHAR cDecimalSeparator;
275 extern INT nNumberGroups;
276
277
278 VOID InitLocale (VOID);
279 VOID PrintDate (VOID);
280 VOID PrintTime (VOID);
281
282 /* cache codepage */
283 extern UINT InputCodePage;
284 extern UINT OutputCodePage;
285
286 /* Prototypes for MEMORY.C */
287 INT CommandMemory (LPTSTR, LPTSTR);
288
289
290 /* Prototypes for MISC.C */
291 TCHAR cgetchar (VOID);
292 BOOL CheckCtrlBreak (INT);
293 LPTSTR *split (LPTSTR, LPINT, BOOL);
294 VOID freep (LPTSTR *);
295 LPTSTR _stpcpy (LPTSTR, LPTSTR);
296 BOOL IsValidPathName (LPCTSTR);
297 BOOL IsExistingFile (LPCTSTR);
298 BOOL IsExistingDirectory (LPCTSTR);
299 BOOL FileGetString (HANDLE, LPTSTR, INT);
300 #ifndef __REACTOS__
301 HWND GetConsoleWindow(VOID);
302 #endif
303
304 #define PROMPT_NO 0
305 #define PROMPT_YES 1
306 #define PROMPT_ALL 2
307 #define PROMPT_BREAK 3
308
309 INT PagePrompt (VOID);
310 INT FilePromptYN (LPTSTR, ...);
311 INT FilePromptYNA (LPTSTR, ...);
312
313
314 /* Prototypes for MOVE.C */
315 INT cmd_move (LPTSTR, LPTSTR);
316
317
318 /* Prototypes for MSGBOX.C */
319 INT CommandMsgbox (LPTSTR, LPTSTR);
320
321
322 /* Prototypes from PATH.C */
323 INT cmd_path (LPTSTR, LPTSTR);
324
325
326 /* Prototypes from PROMPT.C */
327 VOID PrintPrompt (VOID);
328 INT cmd_prompt (LPTSTR, LPTSTR);
329
330
331 /* Prototypes for REDIR.C */
332 #define INPUT_REDIRECTION 1
333 #define OUTPUT_REDIRECTION 2
334 #define OUTPUT_APPEND 4
335 #define ERROR_REDIRECTION 8
336 #define ERROR_APPEND 16
337 INT GetRedirection (LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPINT);
338
339
340 /* Prototypes for REN.C */
341 INT cmd_rename (LPTSTR, LPTSTR);
342
343
344 /* Prototypes for SCREEN.C */
345 INT CommandScreen (LPTSTR, LPTSTR);
346
347
348 /* Prototypes for SET.C */
349 INT cmd_set (LPTSTR, LPTSTR);
350
351
352 /* Prototypes for START.C */
353 INT cmd_start (LPTSTR, LPTSTR);
354
355
356 /* Prototypes for STRTOCLR.C */
357 BOOL StringToColor (LPWORD, LPTSTR *);
358
359
360 /* Prototypes for TIME.C */
361 INT cmd_time (LPTSTR, LPTSTR);
362
363
364 /* Prototypes for TIMER.C */
365 INT CommandTimer (LPTSTR cmd, LPTSTR param);
366
367
368 /* Prototypes for TITLE.C */
369 INT cmd_title (LPTSTR, LPTSTR);
370
371
372 /* Prototypes for TYPE.C */
373 INT cmd_type (LPTSTR, LPTSTR);
374
375
376 /* Prototypes for VER.C */
377 VOID ShortVersion (VOID);
378 INT cmd_ver (LPTSTR, LPTSTR);
379
380
381 /* Prototypes for VERIFY.C */
382 INT cmd_verify (LPTSTR, LPTSTR);
383
384
385 /* Prototypes for VOL.C */
386 INT cmd_vol (LPTSTR, LPTSTR);
387
388
389 /* Prototypes for WHERE.C */
390 BOOL SearchForExecutable (LPCTSTR, LPTSTR);
391
392 /* Prototypes for WINDOW.C */
393 INT CommandActivate (LPTSTR, LPTSTR);
394 INT CommandWindow (LPTSTR, LPTSTR);
395
396
397 /* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
398 int cmd_if(TCHAR *, TCHAR *);
399 int cmd_pause(TCHAR *, TCHAR *);
400 int cmd_shift(TCHAR *, TCHAR *);
401
402 #endif /* _CMD_H_INCLUDED_ */