1 /* $Id: cmd.h,v 1.2 2003/06/01 17:06:22 hbirr Exp $
3 * CMD.H - header file for the modules in CMD.EXE
12 * Moved error messages in here
15 * Moved more error messages here.
17 * 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
18 * Added compile date to version.
20 * 26-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
21 * Introduced a new version string.
22 * Thanks to Emanuele Aliberti!
25 #ifndef _CMD_H_INCLUDED_
26 #define _CMD_H_INCLUDED_
36 #define SHELLVER "Version " CMD_VER " [" __DATE__ ", msc]"
39 #define SHELLVER "Version " CMD_VER " [" __DATE__ ", lcc-win32]"
41 #define SHELLVER "Version " CMD_VER " [" __DATE__ "]"
46 #define BREAK_BATCHFILE 1
47 #define BREAK_OUTOFBATCH 2
49 #define BREAK_IGNORE 4
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"
61 #define SHELLINFO "ReactOS Command Line Interpreter"
68 /* command line buffer length */
70 #define CMDLINE_LENGTH 512
72 #define CMDLINE_LENGTH 8192
73 //#define CMDLINE_LENGTH 1024
76 /* global variables */
79 extern HANDLE hConsole
;
81 extern WORD wDefColor
;
82 extern BOOL bCtrlBreak
;
83 extern BOOL bIgnoreEcho
;
85 extern INT nErrorLevel
;
88 extern OSVERSIONINFO osvi
;
92 /* Prototypes for ALIAS.C */
93 VOID
InitializeAlias (VOID
);
94 VOID
DestroyAlias (VOID
);
95 VOID
ExpandAlias (LPTSTR
, INT
);
96 INT
CommandAlias (LPTSTR
, LPTSTR
);
99 /* Prototypes for ATTRIB.C */
100 INT
CommandAttrib (LPTSTR
, LPTSTR
);
103 /* Prototypes for BEEP.C */
104 INT
cmd_beep (LPTSTR
, LPTSTR
);
107 /* Prototypes for CALL.C */
108 INT
cmd_call (LPTSTR
, LPTSTR
);
111 /* Prototypes for CHCP.C */
112 INT
CommandChcp (LPTSTR
, LPTSTR
);
115 /* Prototypes for CHOICE.C */
116 INT
CommandChoice (LPTSTR
, LPTSTR
);
119 /* Prototypes for CLS.C */
120 INT
cmd_cls (LPTSTR
, LPTSTR
);
123 /* Prototypes for CMD.C */
124 VOID
ParseCommandLine (LPTSTR
);
125 VOID
AddBreakHandler (VOID
);
126 VOID
RemoveBreakHandler (VOID
);
129 /* Prototypes for CMDINPUT.C */
130 VOID
ReadCommand (LPTSTR
, INT
);
133 /* Prototypes for CMDTABLE.C */
134 #define CMD_SPECIAL 1
135 #define CMD_BATCHONLY 2
138 typedef struct tagCOMMAND
142 INT (*func
) (LPTSTR
, LPTSTR
);
143 } COMMAND
, *LPCOMMAND
;
145 extern COMMAND cmds
[]; /* The internal command table */
147 VOID
PrintCommandList (VOID
);
150 /* Prototypes for COLOR.C */
151 VOID
SetScreenColor(WORD wArgColor
, BOOL bFill
);
152 INT
CommandColor (LPTSTR
, LPTSTR
);
155 /* Prototypes for CONSOLE.C */
157 VOID
DebugPrintf (LPTSTR
, ...);
160 VOID
ConInDummy (VOID
);
161 VOID
ConInDisable (VOID
);
162 VOID
ConInEnable (VOID
);
163 VOID
ConInFlush (VOID
);
164 VOID
ConInKey (PINPUT_RECORD
);
165 VOID
ConInString (LPTSTR
, DWORD
);
167 VOID
ConOutChar (TCHAR
);
168 VOID
ConOutPuts (LPTSTR
);
169 VOID
ConOutPrintf (LPTSTR
, ...);
170 VOID
ConErrChar (TCHAR
);
171 VOID
ConErrPuts (LPTSTR
);
172 VOID
ConErrPrintf (LPTSTR
, ...);
174 SHORT
GetCursorX (VOID
);
175 SHORT
GetCursorY (VOID
);
176 VOID
GetCursorXY (PSHORT
, PSHORT
);
177 VOID
SetCursorXY (SHORT
, SHORT
);
179 VOID
GetScreenSize (PSHORT
, PSHORT
);
180 VOID
SetCursorType (BOOL
, BOOL
);
183 /* Prototypes for COPY.C */
184 INT
cmd_copy (LPTSTR
, LPTSTR
);
187 /* Prototypes for DATE.C */
188 INT
cmd_date (LPTSTR
, LPTSTR
);
191 /* Prototypes for DEL.C */
192 INT
CommandDelete (LPTSTR
, LPTSTR
);
195 /* Prototypes for DELAY.C */
196 INT
CommandDelay (LPTSTR
, LPTSTR
);
199 /* Prototypes for DIR.C */
200 INT
CommandDir (LPTSTR
, LPTSTR
);
203 /* Prototypes for DIRSTACK.C */
204 VOID
InitDirectoryStack (VOID
);
205 VOID
DestroyDirectoryStack (VOID
);
206 INT
GetDirectoryStackDepth (VOID
);
207 INT
CommandPushd (LPTSTR
, LPTSTR
);
208 INT
CommandPopd (LPTSTR
, LPTSTR
);
209 INT
CommandDirs (LPTSTR
, LPTSTR
);
212 /* Prototypes for ECHO.C */
213 INT
CommandEcho (LPTSTR
, LPTSTR
);
214 INT
CommandEchos (LPTSTR
, LPTSTR
);
215 INT
CommandEchoerr (LPTSTR
, LPTSTR
);
216 INT
CommandEchoserr (LPTSTR
, LPTSTR
);
219 /* Prototypes for ERROR.C */
220 VOID
ErrorMessage (DWORD
, LPTSTR
, ...);
222 VOID
error_no_pipe (VOID
);
223 VOID
error_bad_command (VOID
);
224 VOID
error_invalid_drive (VOID
);
225 VOID
error_req_param_missing (VOID
);
226 VOID
error_sfile_not_found (LPTSTR
);
227 VOID
error_file_not_found (VOID
);
228 VOID
error_path_not_found (VOID
);
229 VOID
error_too_many_parameters (LPTSTR
);
230 VOID
error_invalid_switch (TCHAR
);
231 VOID
error_invalid_parameter_format (LPTSTR
);
232 VOID
error_out_of_memory (VOID
);
233 VOID
error_syntax (LPTSTR
);
235 VOID
msg_pause (VOID
);
238 /* Prototypes for FILECOMP.C */
239 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
240 VOID
CompleteFilename (LPTSTR
, INT
);
241 INT
ShowCompletionMatches (LPTSTR
, INT
);
243 #ifdef FEATURE_4NT_FILENAME_COMPLETION
247 /* Prototypes for FOR.C */
248 INT
cmd_for (LPTSTR
, LPTSTR
);
251 /* Prototypes for FREE.C */
252 INT
CommandFree (LPTSTR
, LPTSTR
);
255 /* Prototypes for GOTO.C */
256 INT
cmd_goto (LPTSTR
, LPTSTR
);
259 /* Prototypes for HISTORY.C */
260 #ifdef FEATURE_HISTORY
261 VOID
History (INT
, LPTSTR
);/*add entries browse history*/
262 VOID
History_move_to_bottom(VOID
);/*F3*/
263 VOID
InitHistory(VOID
);
264 VOID
CleanHistory(VOID
);
265 VOID
History_del_current_entry(LPTSTR str
);/*CTRL-D*/
266 INT
CommandHistory (LPTSTR cmd
, LPTSTR param
);
270 /* Prototypes for INTERNAL.C */
271 VOID
InitLastPath (VOID
);
272 VOID
FreeLastPath (VOID
);
273 INT
cmd_chdir (LPTSTR
, LPTSTR
);
274 INT
cmd_mkdir (LPTSTR
, LPTSTR
);
275 INT
cmd_rmdir (LPTSTR
, LPTSTR
);
276 INT
CommandExit (LPTSTR
, LPTSTR
);
277 INT
CommandRem (LPTSTR
, LPTSTR
);
278 INT
CommandShowCommands (LPTSTR
, LPTSTR
);
281 /* Prototypes for LABEL.C */
282 INT
cmd_label (LPTSTR
, LPTSTR
);
285 /* Prototypes for LOCALE.C */
286 extern TCHAR cDateSeparator
;
287 extern INT nDateFormat
;
288 extern TCHAR cTimeSeparator
;
289 extern INT nTimeFormat
;
290 extern TCHAR aszDayNames
[7][8];
291 extern TCHAR cThousandSeparator
;
292 extern TCHAR cDecimalSeparator
;
293 extern INT nNumberGroups
;
295 VOID
InitLocale (VOID
);
296 VOID
PrintDate (VOID
);
297 VOID
PrintTime (VOID
);
300 /* Prototypes for MEMORY.C */
301 INT
CommandMemory (LPTSTR
, LPTSTR
);
304 /* Prototypes for MISC.C */
305 TCHAR
cgetchar (VOID
);
306 BOOL
CheckCtrlBreak (INT
);
307 LPTSTR
*split (LPTSTR
, LPINT
, BOOL
);
308 VOID
freep (LPTSTR
*);
309 LPTSTR
stpcpy (LPTSTR
, LPTSTR
);
310 BOOL
IsValidPathName (LPCTSTR
);
311 BOOL
IsValidFileName (LPCTSTR
);
312 BOOL
IsValidDirectory (LPCTSTR
);
313 BOOL
FileGetString (HANDLE
, LPTSTR
, INT
);
315 HWND
GetConsoleWindow(VOID
);
321 #define PROMPT_BREAK 3
323 INT
PagePrompt (VOID
);
324 INT
FilePromptYN (LPTSTR
, ...);
325 INT
FilePromptYNA (LPTSTR
, ...);
328 /* Prototypes for MOVE.C */
329 INT
cmd_move (LPTSTR
, LPTSTR
);
332 /* Prototypes for MSGBOX.C */
333 INT
CommandMsgbox (LPTSTR
, LPTSTR
);
336 /* Prototypes from PATH.C */
337 INT
cmd_path (LPTSTR
, LPTSTR
);
340 /* Prototypes from PROMPT.C */
341 VOID
PrintPrompt (VOID
);
342 INT
cmd_prompt (LPTSTR
, LPTSTR
);
345 /* Prototypes for REDIR.C */
346 #define INPUT_REDIRECTION 1
347 #define OUTPUT_REDIRECTION 2
348 #define OUTPUT_APPEND 4
349 #define ERROR_REDIRECTION 8
350 #define ERROR_APPEND 16
351 INT
GetRedirection (LPTSTR
, LPTSTR
, LPTSTR
, LPTSTR
, LPINT
);
354 /* Prototypes for REN.C */
355 INT
cmd_rename (LPTSTR
, LPTSTR
);
358 /* Prototypes for SCREEN.C */
359 INT
CommandScreen (LPTSTR
, LPTSTR
);
362 /* Prototypes for SET.C */
363 INT
cmd_set (LPTSTR
, LPTSTR
);
366 /* Prototypes for START.C */
367 INT
cmd_start (LPTSTR
, LPTSTR
);
370 /* Prototypes for STRTOCLR.C */
371 BOOL
StringToColor (LPWORD
, LPTSTR
*);
374 /* Prototypes for TIME.C */
375 INT
cmd_time (LPTSTR
, LPTSTR
);
378 /* Prototypes for TIMER.C */
379 INT
CommandTimer (LPTSTR cmd
, LPTSTR param
);
382 /* Prototypes for TITLE.C */
383 INT
cmd_title (LPTSTR
, LPTSTR
);
386 /* Prototypes for TYPE.C */
387 INT
cmd_type (LPTSTR
, LPTSTR
);
390 /* Prototypes for VER.C */
391 VOID
ShortVersion (VOID
);
392 INT
cmd_ver (LPTSTR
, LPTSTR
);
395 /* Prototypes for VERIFY.C */
396 INT
cmd_verify (LPTSTR
, LPTSTR
);
399 /* Prototypes for VOL.C */
400 INT
cmd_vol (LPTSTR
, LPTSTR
);
403 /* Prototypes for WHERE.C */
404 BOOL
SearchForExecutable (LPCTSTR
, LPTSTR
);
406 /* Prototypes for WINDOW.C */
407 INT
CommandActivate (LPTSTR
, LPTSTR
);
408 INT
CommandWindow (LPTSTR
, LPTSTR
);
411 /* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
412 int cmd_if(char *, char *);
413 int cmd_pause(char *, char *);
414 int cmd_shift(char *, char *);
416 #endif /* _CMD_H_INCLUDED_ */