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_
34 #define BREAK_BATCHFILE 1
35 #define BREAK_OUTOFBATCH 2
37 #define BREAK_IGNORE 4
39 /* define some error messages */
42 #define D_OFF _T("off")
45 /* command line buffer length */
47 #define CMDLINE_LENGTH 512
49 #define CMDLINE_LENGTH 8192
50 //#define CMDLINE_LENGTH 1024
53 /* global variables */
56 extern HANDLE hConsole
;
58 extern WORD wDefColor
;
59 extern BOOL bCtrlBreak
;
60 extern BOOL bIgnoreEcho
;
62 extern INT nErrorLevel
;
65 extern OSVERSIONINFO osvi
;
69 /* Prototypes for ALIAS.C */
70 VOID
InitializeAlias (VOID
);
71 VOID
DestroyAlias (VOID
);
72 VOID
ExpandAlias (LPTSTR
, INT
);
73 INT
CommandAlias (LPTSTR
, LPTSTR
);
76 /* Prototypes for ATTRIB.C */
77 INT
CommandAttrib (LPTSTR
, LPTSTR
);
80 /* Prototypes for BEEP.C */
81 INT
cmd_beep (LPTSTR
, LPTSTR
);
84 /* Prototypes for CALL.C */
85 INT
cmd_call (LPTSTR
, LPTSTR
);
88 /* Prototypes for CHCP.C */
89 INT
CommandChcp (LPTSTR
, LPTSTR
);
92 /* Prototypes for CHOICE.C */
93 INT
CommandChoice (LPTSTR
, LPTSTR
);
96 /* Prototypes for CLS.C */
97 INT
cmd_cls (LPTSTR
, LPTSTR
);
100 /* Prototypes for CMD.C */
101 VOID
ParseCommandLine (LPTSTR
);
102 VOID
AddBreakHandler (VOID
);
103 VOID
RemoveBreakHandler (VOID
);
105 extern HANDLE CMD_ModuleHandle
;
108 /* Prototypes for CMDINPUT.C */
109 VOID
ReadCommand (LPTSTR
, INT
);
112 /* Prototypes for CMDTABLE.C */
113 #define CMD_SPECIAL 1
114 #define CMD_BATCHONLY 2
117 typedef struct tagCOMMAND
121 INT (*func
) (LPTSTR
, LPTSTR
);
122 } COMMAND
, *LPCOMMAND
;
124 extern COMMAND cmds
[]; /* The internal command table */
126 VOID
PrintCommandList (VOID
);
127 VOID
PrintCommandListDetail (VOID
);
130 /* Prototypes for COLOR.C */
131 VOID
SetScreenColor(WORD wArgColor
, BOOL bFill
);
132 INT
CommandColor (LPTSTR
, LPTSTR
);
135 /* Prototypes for CONSOLE.C */
137 VOID
DebugPrintf (LPTSTR
, ...);
140 VOID
ConInDummy (VOID
);
141 VOID
ConInDisable (VOID
);
142 VOID
ConInEnable (VOID
);
143 VOID
ConInFlush (VOID
);
144 VOID
ConInKey (PINPUT_RECORD
);
145 VOID
ConInString (LPTSTR
, DWORD
);
147 VOID
ConOutChar (TCHAR
);
148 VOID
ConOutPuts (LPTSTR
);
149 VOID
ConOutPrintf (LPTSTR
, ...);
150 VOID
ConErrChar (TCHAR
);
151 VOID
ConErrPuts (LPTSTR
);
152 VOID
ConErrPrintf (LPTSTR
, ...);
153 VOID
ConOutFormatMessage (DWORD MessageId
, ...);
155 SHORT
GetCursorX (VOID
);
156 SHORT
GetCursorY (VOID
);
157 VOID
GetCursorXY (PSHORT
, PSHORT
);
158 VOID
SetCursorXY (SHORT
, SHORT
);
160 VOID
GetScreenSize (PSHORT
, PSHORT
);
161 VOID
SetCursorType (BOOL
, BOOL
);
163 VOID
ConOutResPuts (UINT resID
);
164 VOID
ConErrResPuts (UINT resID
);
166 /* Prototypes for COPY.C */
167 INT
cmd_copy (LPTSTR
, LPTSTR
);
170 /* Prototypes for DATE.C */
171 INT
cmd_date (LPTSTR
, LPTSTR
);
174 /* Prototypes for DEL.C */
175 INT
CommandDelete (LPTSTR
, LPTSTR
);
178 /* Prototypes for DELAY.C */
179 INT
CommandDelay (LPTSTR
, LPTSTR
);
182 /* Prototypes for DIR.C */
183 INT
CommandDir (LPTSTR
, LPTSTR
);
186 /* Prototypes for DIRSTACK.C */
187 VOID
InitDirectoryStack (VOID
);
188 VOID
DestroyDirectoryStack (VOID
);
189 INT
GetDirectoryStackDepth (VOID
);
190 INT
CommandPushd (LPTSTR
, LPTSTR
);
191 INT
CommandPopd (LPTSTR
, LPTSTR
);
192 INT
CommandDirs (LPTSTR
, LPTSTR
);
195 /* Prototypes for ECHO.C */
196 INT
CommandEcho (LPTSTR
, LPTSTR
);
197 INT
CommandEchos (LPTSTR
, LPTSTR
);
198 INT
CommandEchoerr (LPTSTR
, LPTSTR
);
199 INT
CommandEchoserr (LPTSTR
, LPTSTR
);
202 /* Prototypes for ERROR.C */
203 VOID
ErrorMessage (DWORD
, LPTSTR
, ...);
205 VOID
error_no_pipe (VOID
);
206 VOID
error_bad_command (VOID
);
207 VOID
error_invalid_drive (VOID
);
208 VOID
error_req_param_missing (VOID
);
209 VOID
error_sfile_not_found (LPTSTR
);
210 VOID
error_file_not_found (VOID
);
211 VOID
error_path_not_found (VOID
);
212 VOID
error_too_many_parameters (LPTSTR
);
213 VOID
error_parameter_format(TCHAR
);
214 VOID
error_invalid_switch (TCHAR
);
215 VOID
error_invalid_parameter_format (LPTSTR
);
216 VOID
error_out_of_memory (VOID
);
217 VOID
error_syntax (LPTSTR
);
219 VOID
msg_pause (VOID
);
222 /* Prototypes for FILECOMP.C */
223 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
224 VOID
CompleteFilename (LPTSTR
, INT
);
225 INT
ShowCompletionMatches (LPTSTR
, INT
);
227 #ifdef FEATURE_4NT_FILENAME_COMPLETION
231 /* Prototypes for FOR.C */
232 INT
cmd_for (LPTSTR
, LPTSTR
);
235 /* Prototypes for FREE.C */
236 INT
CommandFree (LPTSTR
, LPTSTR
);
239 /* Prototypes for GOTO.C */
240 INT
cmd_goto (LPTSTR
, LPTSTR
);
243 /* Prototypes for HISTORY.C */
244 #ifdef FEATURE_HISTORY
245 VOID
History (INT
, LPTSTR
);/*add entries browse history*/
246 VOID
History_move_to_bottom(VOID
);/*F3*/
247 VOID
InitHistory(VOID
);
248 VOID
CleanHistory(VOID
);
249 VOID
History_del_current_entry(LPTSTR str
);/*CTRL-D*/
250 INT
CommandHistory (LPTSTR cmd
, LPTSTR param
);
254 /* Prototypes for INTERNAL.C */
255 VOID
InitLastPath (VOID
);
256 VOID
FreeLastPath (VOID
);
257 INT
cmd_chdir (LPTSTR
, LPTSTR
);
258 INT
cmd_mkdir (LPTSTR
, LPTSTR
);
259 INT
cmd_rmdir (LPTSTR
, LPTSTR
);
260 INT
CommandExit (LPTSTR
, LPTSTR
);
261 INT
CommandRem (LPTSTR
, LPTSTR
);
262 INT
CommandShowCommands (LPTSTR
, LPTSTR
);
263 INT
CommandShowCommandsDetail (LPTSTR
, LPTSTR
);
265 /* Prototypes for LABEL.C */
266 INT
cmd_label (LPTSTR
, LPTSTR
);
269 /* Prototypes for LOCALE.C */
270 extern TCHAR cDateSeparator
;
271 extern INT nDateFormat
;
272 extern TCHAR cTimeSeparator
;
273 extern INT nTimeFormat
;
274 extern TCHAR cThousandSeparator
;
275 extern TCHAR cDecimalSeparator
;
276 extern INT nNumberGroups
;
279 VOID
InitLocale (VOID
);
280 VOID
PrintDate (VOID
);
281 VOID
PrintTime (VOID
);
284 extern UINT InputCodePage
;
285 extern UINT OutputCodePage
;
287 /* Prototypes for MEMORY.C */
288 INT
CommandMemory (LPTSTR
, LPTSTR
);
291 /* Prototypes for MISC.C */
292 TCHAR
cgetchar (VOID
);
293 BOOL
CheckCtrlBreak (INT
);
294 LPTSTR
*split (LPTSTR
, LPINT
, BOOL
);
295 VOID
freep (LPTSTR
*);
296 LPTSTR
_stpcpy (LPTSTR
, LPTSTR
);
297 BOOL
IsValidPathName (LPCTSTR
);
298 BOOL
IsExistingFile (LPCTSTR
);
299 BOOL
IsExistingDirectory (LPCTSTR
);
300 BOOL
FileGetString (HANDLE
, LPTSTR
, INT
);
302 HWND
GetConsoleWindow(VOID
);
308 #define PROMPT_BREAK 3
310 INT
PagePrompt (VOID
);
311 INT
FilePromptYN (LPTSTR
, ...);
312 INT
FilePromptYNA (LPTSTR
, ...);
315 /* Prototypes for MOVE.C */
316 INT
cmd_move (LPTSTR
, LPTSTR
);
319 /* Prototypes for MSGBOX.C */
320 INT
CommandMsgbox (LPTSTR
, LPTSTR
);
323 /* Prototypes from PATH.C */
324 INT
cmd_path (LPTSTR
, LPTSTR
);
327 /* Prototypes from PROMPT.C */
328 VOID
PrintPrompt (VOID
);
329 INT
cmd_prompt (LPTSTR
, LPTSTR
);
332 /* Prototypes for REDIR.C */
333 #define INPUT_REDIRECTION 1
334 #define OUTPUT_REDIRECTION 2
335 #define OUTPUT_APPEND 4
336 #define ERROR_REDIRECTION 8
337 #define ERROR_APPEND 16
338 INT
GetRedirection (LPTSTR
, LPTSTR
, LPTSTR
, LPTSTR
, LPINT
);
341 /* Prototypes for REN.C */
342 INT
cmd_rename (LPTSTR
, LPTSTR
);
345 /* Prototypes for SCREEN.C */
346 INT
CommandScreen (LPTSTR
, LPTSTR
);
349 /* Prototypes for SET.C */
350 INT
cmd_set (LPTSTR
, LPTSTR
);
353 /* Prototypes for START.C */
354 INT
cmd_start (LPTSTR
, LPTSTR
);
357 /* Prototypes for STRTOCLR.C */
358 BOOL
StringToColor (LPWORD
, LPTSTR
*);
361 /* Prototypes for TIME.C */
362 INT
cmd_time (LPTSTR
, LPTSTR
);
365 /* Prototypes for TIMER.C */
366 INT
CommandTimer (LPTSTR cmd
, LPTSTR param
);
369 /* Prototypes for TITLE.C */
370 INT
cmd_title (LPTSTR
, LPTSTR
);
373 /* Prototypes for TYPE.C */
374 INT
cmd_type (LPTSTR
, LPTSTR
);
377 /* Prototypes for VER.C */
378 VOID
ShortVersion (VOID
);
379 INT
cmd_ver (LPTSTR
, LPTSTR
);
382 /* Prototypes for VERIFY.C */
383 INT
cmd_verify (LPTSTR
, LPTSTR
);
386 /* Prototypes for VOL.C */
387 INT
cmd_vol (LPTSTR
, LPTSTR
);
390 /* Prototypes for WHERE.C */
391 BOOL
SearchForExecutable (LPCTSTR
, LPTSTR
);
393 /* Prototypes for WINDOW.C */
394 INT
CommandActivate (LPTSTR
, LPTSTR
);
395 INT
CommandWindow (LPTSTR
, LPTSTR
);
398 /* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
399 int cmd_if(TCHAR
*, TCHAR
*);
400 int cmd_pause(TCHAR
*, TCHAR
*);
401 int cmd_shift(TCHAR
*, TCHAR
*);
403 #endif /* _CMD_H_INCLUDED_ */