5bc2da4f7f9aa95fe761b1f5e4dd62ce821d7a93
2 * CMD.H - header file for the modules in CMD.EXE
11 * Moved error messages in here
14 * Moved more error messages here.
16 * 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
17 * Added compile date to version.
19 * 26-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
20 * Introduced a new version string.
21 * Thanks to Emanuele Aliberti!
24 #ifndef _CMD_H_INCLUDED_
25 #define _CMD_H_INCLUDED_
35 #define SHELLVER "Version " CMD_VER " [" __DATE__ ", msc]"
38 #define SHELLVER "Version " CMD_VER " [" __DATE__ ", lcc-win32]"
40 #define SHELLVER "Version " CMD_VER " [" __DATE__ "]"
45 #define BREAK_BATCHFILE 1
46 #define BREAK_OUTOFBATCH 2
48 #define BREAK_IGNORE 4
50 /* define some error messages */
51 #define NOENVERR _T("ERROR: no environment")
52 #define INVALIDDRIVE _T("ERROR: invalid drive")
53 #define INVALIDFUNCTION _T("ERROR: invalid function")
54 #define ACCESSDENIED _T("ERROR: access denied")
55 #define BADENVIROMENT _T("ERROR: bad enviroment")
56 #define BADFORMAT _T("ERROR: bad format")
57 #define ERROR_E2BIG _T("ERROR: Argument list too long")
58 #define ERROR_EINVAL _T("ERROR: Invalid argument")
60 #define SHELLINFO "ReactOS Command Line Interpreter"
64 #define D_OFF _T("off")
67 /* command line buffer length */
69 #define CMDLINE_LENGTH 512
71 #define CMDLINE_LENGTH 8192
72 //#define CMDLINE_LENGTH 1024
75 /* global variables */
78 extern HANDLE hConsole
;
80 extern WORD wDefColor
;
81 extern BOOL bCtrlBreak
;
82 extern BOOL bIgnoreEcho
;
84 extern INT nErrorLevel
;
87 extern OSVERSIONINFO osvi
;
91 /* Prototypes for ALIAS.C */
92 VOID
InitializeAlias (VOID
);
93 VOID
DestroyAlias (VOID
);
94 VOID
ExpandAlias (LPTSTR
, INT
);
95 INT
CommandAlias (LPTSTR
, LPTSTR
);
98 /* Prototypes for ATTRIB.C */
99 INT
CommandAttrib (LPTSTR
, LPTSTR
);
102 /* Prototypes for BEEP.C */
103 INT
cmd_beep (LPTSTR
, LPTSTR
);
106 /* Prototypes for CALL.C */
107 INT
cmd_call (LPTSTR
, LPTSTR
);
110 /* Prototypes for CHCP.C */
111 INT
CommandChcp (LPTSTR
, LPTSTR
);
114 /* Prototypes for CHOICE.C */
115 INT
CommandChoice (LPTSTR
, LPTSTR
);
118 /* Prototypes for CLS.C */
119 INT
cmd_cls (LPTSTR
, LPTSTR
);
122 /* Prototypes for CMD.C */
123 VOID
ParseCommandLine (LPTSTR
);
124 VOID
AddBreakHandler (VOID
);
125 VOID
RemoveBreakHandler (VOID
);
127 extern HANDLE CMD_ModuleHandle
;
130 /* Prototypes for CMDINPUT.C */
131 VOID
ReadCommand (LPTSTR
, INT
);
134 /* Prototypes for CMDTABLE.C */
135 #define CMD_SPECIAL 1
136 #define CMD_BATCHONLY 2
139 typedef struct tagCOMMAND
143 INT (*func
) (LPTSTR
, LPTSTR
);
144 } COMMAND
, *LPCOMMAND
;
146 extern COMMAND cmds
[]; /* The internal command table */
148 VOID
PrintCommandList (VOID
);
151 /* Prototypes for COLOR.C */
152 VOID
SetScreenColor(WORD wArgColor
, BOOL bFill
);
153 INT
CommandColor (LPTSTR
, LPTSTR
);
156 /* Prototypes for CONSOLE.C */
158 VOID
DebugPrintf (LPTSTR
, ...);
161 VOID
ConInDummy (VOID
);
162 VOID
ConInDisable (VOID
);
163 VOID
ConInEnable (VOID
);
164 VOID
ConInFlush (VOID
);
165 VOID
ConInKey (PINPUT_RECORD
);
166 VOID
ConInString (LPTSTR
, DWORD
);
168 VOID
ConOutChar (TCHAR
);
169 VOID
ConOutPuts (LPTSTR
);
170 VOID
ConOutPrintf (LPTSTR
, ...);
171 VOID
ConErrChar (TCHAR
);
172 VOID
ConErrPuts (LPTSTR
);
173 VOID
ConErrPrintf (LPTSTR
, ...);
174 VOID
ConOutFormatMessage (DWORD MessageId
, ...);
176 SHORT
GetCursorX (VOID
);
177 SHORT
GetCursorY (VOID
);
178 VOID
GetCursorXY (PSHORT
, PSHORT
);
179 VOID
SetCursorXY (SHORT
, SHORT
);
181 VOID
GetScreenSize (PSHORT
, PSHORT
);
182 VOID
SetCursorType (BOOL
, BOOL
);
184 VOID
ConOutResPuts (UINT resID
);
185 VOID
ConErrResPuts (UINT resID
);
187 /* Prototypes for COPY.C */
188 INT
cmd_copy (LPTSTR
, LPTSTR
);
191 /* Prototypes for DATE.C */
192 INT
cmd_date (LPTSTR
, LPTSTR
);
195 /* Prototypes for DEL.C */
196 INT
CommandDelete (LPTSTR
, LPTSTR
);
199 /* Prototypes for DELAY.C */
200 INT
CommandDelay (LPTSTR
, LPTSTR
);
203 /* Prototypes for DIR.C */
204 INT
CommandDir (LPTSTR
, LPTSTR
);
207 /* Prototypes for DIRSTACK.C */
208 VOID
InitDirectoryStack (VOID
);
209 VOID
DestroyDirectoryStack (VOID
);
210 INT
GetDirectoryStackDepth (VOID
);
211 INT
CommandPushd (LPTSTR
, LPTSTR
);
212 INT
CommandPopd (LPTSTR
, LPTSTR
);
213 INT
CommandDirs (LPTSTR
, LPTSTR
);
216 /* Prototypes for ECHO.C */
217 INT
CommandEcho (LPTSTR
, LPTSTR
);
218 INT
CommandEchos (LPTSTR
, LPTSTR
);
219 INT
CommandEchoerr (LPTSTR
, LPTSTR
);
220 INT
CommandEchoserr (LPTSTR
, LPTSTR
);
223 /* Prototypes for ERROR.C */
224 VOID
ErrorMessage (DWORD
, LPTSTR
, ...);
226 VOID
error_no_pipe (VOID
);
227 VOID
error_bad_command (VOID
);
228 VOID
error_invalid_drive (VOID
);
229 VOID
error_req_param_missing (VOID
);
230 VOID
error_sfile_not_found (LPTSTR
);
231 VOID
error_file_not_found (VOID
);
232 VOID
error_path_not_found (VOID
);
233 VOID
error_too_many_parameters (LPTSTR
);
234 VOID
error_parameter_format(TCHAR
);
235 VOID
error_invalid_switch (TCHAR
);
236 VOID
error_invalid_parameter_format (LPTSTR
);
237 VOID
error_out_of_memory (VOID
);
238 VOID
error_syntax (LPTSTR
);
240 VOID
msg_pause (VOID
);
243 /* Prototypes for FILECOMP.C */
244 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
245 VOID
CompleteFilename (LPTSTR
, INT
);
246 INT
ShowCompletionMatches (LPTSTR
, INT
);
248 #ifdef FEATURE_4NT_FILENAME_COMPLETION
252 /* Prototypes for FOR.C */
253 INT
cmd_for (LPTSTR
, LPTSTR
);
256 /* Prototypes for FREE.C */
257 INT
CommandFree (LPTSTR
, LPTSTR
);
260 /* Prototypes for GOTO.C */
261 INT
cmd_goto (LPTSTR
, LPTSTR
);
264 /* Prototypes for HISTORY.C */
265 #ifdef FEATURE_HISTORY
266 VOID
History (INT
, LPTSTR
);/*add entries browse history*/
267 VOID
History_move_to_bottom(VOID
);/*F3*/
268 VOID
InitHistory(VOID
);
269 VOID
CleanHistory(VOID
);
270 VOID
History_del_current_entry(LPTSTR str
);/*CTRL-D*/
271 INT
CommandHistory (LPTSTR cmd
, LPTSTR param
);
275 /* Prototypes for INTERNAL.C */
276 VOID
InitLastPath (VOID
);
277 VOID
FreeLastPath (VOID
);
278 INT
cmd_chdir (LPTSTR
, LPTSTR
);
279 INT
cmd_mkdir (LPTSTR
, LPTSTR
);
280 INT
cmd_rmdir (LPTSTR
, LPTSTR
);
281 INT
CommandExit (LPTSTR
, LPTSTR
);
282 INT
CommandRem (LPTSTR
, LPTSTR
);
283 INT
CommandShowCommands (LPTSTR
, LPTSTR
);
286 /* Prototypes for LABEL.C */
287 INT
cmd_label (LPTSTR
, LPTSTR
);
290 /* Prototypes for LOCALE.C */
291 extern TCHAR cDateSeparator
;
292 extern INT nDateFormat
;
293 extern TCHAR cTimeSeparator
;
294 extern INT nTimeFormat
;
295 extern TCHAR cThousandSeparator
;
296 extern TCHAR cDecimalSeparator
;
297 extern INT nNumberGroups
;
300 VOID
InitLocale (VOID
);
301 VOID
PrintDate (VOID
);
302 VOID
PrintTime (VOID
);
305 extern UINT InputCodePage
;
306 extern UINT OutputCodePage
;
308 /* Prototypes for MEMORY.C */
309 INT
CommandMemory (LPTSTR
, LPTSTR
);
312 /* Prototypes for MISC.C */
313 TCHAR
cgetchar (VOID
);
314 BOOL
CheckCtrlBreak (INT
);
315 LPTSTR
*split (LPTSTR
, LPINT
, BOOL
);
316 VOID
freep (LPTSTR
*);
317 LPTSTR
_stpcpy (LPTSTR
, LPTSTR
);
318 BOOL
IsValidPathName (LPCTSTR
);
319 BOOL
IsExistingFile (LPCTSTR
);
320 BOOL
IsExistingDirectory (LPCTSTR
);
321 BOOL
FileGetString (HANDLE
, LPTSTR
, INT
);
323 HWND
GetConsoleWindow(VOID
);
329 #define PROMPT_BREAK 3
331 INT
PagePrompt (VOID
);
332 INT
FilePromptYN (LPTSTR
, ...);
333 INT
FilePromptYNA (LPTSTR
, ...);
336 /* Prototypes for MOVE.C */
337 INT
cmd_move (LPTSTR
, LPTSTR
);
340 /* Prototypes for MSGBOX.C */
341 INT
CommandMsgbox (LPTSTR
, LPTSTR
);
344 /* Prototypes from PATH.C */
345 INT
cmd_path (LPTSTR
, LPTSTR
);
348 /* Prototypes from PROMPT.C */
349 VOID
PrintPrompt (VOID
);
350 INT
cmd_prompt (LPTSTR
, LPTSTR
);
353 /* Prototypes for REDIR.C */
354 #define INPUT_REDIRECTION 1
355 #define OUTPUT_REDIRECTION 2
356 #define OUTPUT_APPEND 4
357 #define ERROR_REDIRECTION 8
358 #define ERROR_APPEND 16
359 INT
GetRedirection (LPTSTR
, LPTSTR
, LPTSTR
, LPTSTR
, LPINT
);
362 /* Prototypes for REN.C */
363 INT
cmd_rename (LPTSTR
, LPTSTR
);
366 /* Prototypes for SCREEN.C */
367 INT
CommandScreen (LPTSTR
, LPTSTR
);
370 /* Prototypes for SET.C */
371 INT
cmd_set (LPTSTR
, LPTSTR
);
374 /* Prototypes for START.C */
375 INT
cmd_start (LPTSTR
, LPTSTR
);
378 /* Prototypes for STRTOCLR.C */
379 BOOL
StringToColor (LPWORD
, LPTSTR
*);
382 /* Prototypes for TIME.C */
383 INT
cmd_time (LPTSTR
, LPTSTR
);
386 /* Prototypes for TIMER.C */
387 INT
CommandTimer (LPTSTR cmd
, LPTSTR param
);
390 /* Prototypes for TITLE.C */
391 INT
cmd_title (LPTSTR
, LPTSTR
);
394 /* Prototypes for TYPE.C */
395 INT
cmd_type (LPTSTR
, LPTSTR
);
398 /* Prototypes for VER.C */
399 VOID
ShortVersion (VOID
);
400 INT
cmd_ver (LPTSTR
, LPTSTR
);
403 /* Prototypes for VERIFY.C */
404 INT
cmd_verify (LPTSTR
, LPTSTR
);
407 /* Prototypes for VOL.C */
408 INT
cmd_vol (LPTSTR
, LPTSTR
);
411 /* Prototypes for WHERE.C */
412 BOOL
SearchForExecutable (LPCTSTR
, LPTSTR
);
414 /* Prototypes for WINDOW.C */
415 INT
CommandActivate (LPTSTR
, LPTSTR
);
416 INT
CommandWindow (LPTSTR
, LPTSTR
);
419 /* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
420 int cmd_if(TCHAR
*, TCHAR
*);
421 int cmd_pause(TCHAR
*, TCHAR
*);
422 int cmd_shift(TCHAR
*, TCHAR
*);
424 #endif /* _CMD_H_INCLUDED_ */