1 /* $Id: cmd.h,v 1.21 2001/02/03 10:37:51 ekohl 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 */
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
);
128 /* Prototypes for CMDINPUT.C */
129 VOID
ReadCommand (LPTSTR
, INT
);
132 /* Prototypes for CMDTABLE.C */
133 #define CMD_SPECIAL 1
134 #define CMD_BATCHONLY 2
137 typedef struct tagCOMMAND
141 INT (*func
) (LPTSTR
, LPTSTR
);
142 } COMMAND
, *LPCOMMAND
;
144 extern COMMAND cmds
[]; /* The internal command table */
146 VOID
PrintCommandList (VOID
);
149 /* Prototypes for COLOR.C */
150 VOID
SetScreenColor(WORD wArgColor
, BOOL bFill
);
151 INT
CommandColor (LPTSTR
, LPTSTR
);
154 /* Prototypes for CONSOLE.C */
156 VOID
DebugPrintf (LPTSTR
, ...);
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
);
166 VOID
ConOutChar (TCHAR
);
167 VOID
ConOutPuts (LPTSTR
);
168 VOID
ConOutPrintf (LPTSTR
, ...);
169 VOID
ConErrChar (TCHAR
);
170 VOID
ConErrPuts (LPTSTR
);
171 VOID
ConErrPrintf (LPTSTR
, ...);
173 SHORT
GetCursorX (VOID
);
174 SHORT
GetCursorY (VOID
);
175 VOID
GetCursorXY (PSHORT
, PSHORT
);
176 VOID
SetCursorXY (SHORT
, SHORT
);
178 VOID
GetScreenSize (PSHORT
, PSHORT
);
179 VOID
SetCursorType (BOOL
, BOOL
);
182 /* Prototypes for COPY.C */
183 INT
cmd_copy (LPTSTR
, LPTSTR
);
186 /* Prototypes for DATE.C */
187 INT
cmd_date (LPTSTR
, LPTSTR
);
190 /* Prototypes for DEL.C */
191 INT
CommandDelete (LPTSTR
, LPTSTR
);
194 /* Prototypes for DELAY.C */
195 INT
CommandDelay (LPTSTR
, LPTSTR
);
198 /* Prototypes for DIR.C */
199 INT
CommandDir (LPTSTR
, LPTSTR
);
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
);
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
);
218 /* Prototypes for ERROR.C */
219 VOID
ErrorMessage (DWORD
, LPTSTR
, ...);
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
);
234 VOID
msg_pause (VOID
);
237 /* Prototypes for FILECOMP.C */
238 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
239 VOID
CompleteFilename (LPTSTR
, INT
);
240 INT
ShowCompletionMatches (LPTSTR
, INT
);
242 #ifdef FEATURE_4NT_FILENAME_COMPLETION
246 /* Prototypes for FOR.C */
247 INT
cmd_for (LPTSTR
, LPTSTR
);
250 /* Prototypes for FREE.C */
251 INT
CommandFree (LPTSTR
, LPTSTR
);
254 /* Prototypes for GOTO.C */
255 INT
cmd_goto (LPTSTR
, LPTSTR
);
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
);
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
);
280 /* Prototypes for LABEL.C */
281 INT
cmd_label (LPTSTR
, LPTSTR
);
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
;
294 VOID
InitLocale (VOID
);
295 VOID
PrintDate (VOID
);
296 VOID
PrintTime (VOID
);
299 /* Prototypes for MEMORY.C */
300 INT
CommandMemory (LPTSTR
, LPTSTR
);
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
);
314 HWND
GetConsoleWindow(VOID
);
320 #define PROMPT_BREAK 3
322 INT
PagePrompt (VOID
);
323 INT
FilePromptYN (LPTSTR
, ...);
324 INT
FilePromptYNA (LPTSTR
, ...);
327 /* Prototypes for MOVE.C */
328 INT
cmd_move (LPTSTR
, LPTSTR
);
331 /* Prototypes for MSGBOX.C */
332 INT
CommandMsgbox (LPTSTR
, LPTSTR
);
335 /* Prototypes from PATH.C */
336 INT
cmd_path (LPTSTR
, LPTSTR
);
339 /* Prototypes from PROMPT.C */
340 VOID
PrintPrompt (VOID
);
341 INT
cmd_prompt (LPTSTR
, LPTSTR
);
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
);
353 /* Prototypes for REN.C */
354 INT
cmd_rename (LPTSTR
, LPTSTR
);
357 /* Prototypes for SCREEN.C */
358 INT
CommandScreen (LPTSTR
, LPTSTR
);
361 /* Prototypes for SET.C */
362 INT
cmd_set (LPTSTR
, LPTSTR
);
365 /* Prototypes for START.C */
366 INT
cmd_start (LPTSTR
, LPTSTR
);
369 /* Prototypes for STRTOCLR.C */
370 BOOL
StringToColor (LPWORD
, LPTSTR
*);
373 /* Prototypes for TIME.C */
374 INT
cmd_time (LPTSTR
, LPTSTR
);
377 /* Prototypes for TIMER.C */
378 INT
CommandTimer (LPTSTR cmd
, LPTSTR param
);
381 /* Prototypes for TITLE.C */
382 INT
cmd_title (LPTSTR
, LPTSTR
);
385 /* Prototypes for TYPE.C */
386 INT
cmd_type (LPTSTR
, LPTSTR
);
389 /* Prototypes for VER.C */
390 VOID
ShortVersion (VOID
);
391 INT
cmd_ver (LPTSTR
, LPTSTR
);
394 /* Prototypes for VERIFY.C */
395 INT
cmd_verify (LPTSTR
, LPTSTR
);
398 /* Prototypes for VOL.C */
399 INT
cmd_vol (LPTSTR
, LPTSTR
);
402 /* Prototypes for WHERE.C */
403 BOOL
SearchForExecutable (LPCTSTR
, LPTSTR
);
405 /* Prototypes for WINDOW.C */
406 INT
CommandActivate (LPTSTR
, LPTSTR
);
407 INT
CommandWindow (LPTSTR
, LPTSTR
);
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 *);
415 #endif /* _CMD_H_INCLUDED_ */