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