Added Eric Kohl's port of freedos command
[reactos.git] / rosapps / cmd / cmd.h
1 /*
2 * CMD.H - header file for the modules in CMD.EXE
3 *
4 *
5 * History:
6 *
7 * 7-15-95 Tim Norman
8 * started
9 *
10 * 06/29/98 (Rob Lake)
11 * Moved error messages in here
12 *
13 * 07/12/98 (Rob Lake)
14 * Moved more error messages here
15 *
16 * 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
17 * Added compile date to version
18 */
19
20 // #define WIN32_LEAN_AND_MEAN
21
22 #include <windows.h>
23 // #include <tchar.h>
24
25 #define SHELLVER "version 0.0.4 [" __DATE__"]"
26
27 #define BREAK_BATCHFILE 1
28 #define BREAK_OUTOFBATCH 2
29 #define BREAK_INPUT 3
30 #define BREAK_IGNORE 4
31
32 /* define some error messages */
33 #define NOENVERR "ERROR: no environment"
34 #define INVALIDDRIVE "ERROR: invalid drive"
35 #define INVALIDFUNCTION "ERROR: invalid function"
36 #define ACCESSDENIED "ERROR: access denied"
37 #define BADENVIROMENT "ERROR: bad enviroment"
38 #define BADFORMAT "ERROR: bad format"
39 #define ERROR_E2BIG "ERROR: Argument list too long"
40 #define ERROR_EINVAL "ERROR: Invalid argument"
41
42 #define SHELLINFO "ReactOS Command Line Interface"
43 #define USAGE "usage"
44
45
46 #define D_ON "on"
47 #define D_OFF "off"
48
49
50
51 /* prototypes for CMD.C */
52 extern HANDLE hOut;
53 extern HANDLE hIn;
54 extern WORD wColor;
55 extern WORD wDefColor;
56 extern BOOL bCtrlBreak;
57 extern BOOL bIgnoreEcho;
58 extern BOOL bExit;
59 extern int errorlevel;
60 extern SHORT maxx;
61 extern SHORT maxy;
62 extern OSVERSIONINFO osvi;
63
64
65 // VOID Execute (char *, char *);
66 void command(char *);
67 VOID ParseCommandLine (LPTSTR);
68 int c_brk(void);
69
70
71
72
73 /* prototypes for ALIAS.C */
74 VOID ExpandAlias (char *, int);
75 INT cmd_alias (LPTSTR, LPTSTR);
76
77
78 /* prototyped for ATTRIB.C */
79 INT cmd_attrib (LPTSTR, LPTSTR);
80
81
82 /* prototypes for CLS.C */
83 INT cmd_cls (LPTSTR, LPTSTR);
84
85
86 /* prototypes for CMDINPUT.C */
87 VOID ReadCommand (LPTSTR, INT);
88
89
90 /* prototypes for CMDTABLE.C */
91 #define CMD_SPECIAL 1
92 #define CMD_BATCHONLY 2
93
94 typedef struct tagCOMMAND
95 {
96 LPTSTR name;
97 INT flags;
98 INT (*func) (LPTSTR, LPTSTR);
99 } COMMAND, *LPCOMMAND;
100
101
102 /* prototypes for COLOR.C */
103 VOID SetScreenColor (WORD);
104 INT cmd_color (LPTSTR, LPTSTR);
105
106
107 /* prototypes for CONSOLE.C */
108 #ifdef _DEBUG
109 VOID DebugPrintf (LPTSTR, ...);
110 #endif /* _DEBUG */
111
112 VOID ConInDummy (VOID);
113 VOID ConInKey (PINPUT_RECORD);
114
115 VOID ConInString (LPTSTR, DWORD);
116
117
118 VOID ConOutChar (TCHAR);
119 VOID ConOutPuts (LPTSTR);
120 VOID ConOutPrintf (LPTSTR, ...);
121 VOID ConErrChar (TCHAR);
122 VOID ConErrPuts (LPTSTR);
123 VOID ConErrPrintf (LPTSTR, ...);
124
125
126 SHORT wherex (VOID);
127 SHORT wherey (VOID);
128 VOID goxy (SHORT, SHORT);
129
130 VOID GetScreenSize (PSHORT, PSHORT);
131 VOID SetCursorType (BOOL, BOOL);
132
133
134 /* prototypes for COPY.C */
135 INT cmd_copy (LPTSTR, LPTSTR);
136
137
138 /* prototypes for DATE.C */
139 INT cmd_date (LPTSTR, LPTSTR);
140
141
142 /* prototypes for DEL.C */
143 INT cmd_del (LPTSTR, LPTSTR);
144
145
146 /* prototypes for DIR.C */
147 //int incline(int *line, unsigned flags);
148 INT cmd_dir (LPTSTR, LPTSTR);
149
150
151 /* prototypes for DIRSTACK.C */
152 VOID InitDirectoryStack (VOID);
153 VOID DestroyDirectoryStack (VOID);
154 INT GetDirectoryStackDepth (VOID);
155 INT cmd_pushd (LPTSTR, LPTSTR);
156 INT cmd_popd (LPTSTR, LPTSTR);
157
158
159 /* Prototypes for ERROR.C */
160 VOID ErrorMessage (DWORD, LPTSTR, ...);
161
162 VOID error_no_pipe (VOID);
163 VOID error_bad_command (VOID);
164 VOID error_invalid_drive (VOID);
165 VOID error_req_param_missing (VOID);
166 VOID error_sfile_not_found (LPTSTR);
167 VOID error_file_not_found (VOID);
168 VOID error_path_not_found (VOID);
169 VOID error_too_many_parameters (LPTSTR);
170 VOID error_invalid_switch (TCHAR);
171 VOID error_invalid_parameter_format (LPTSTR);
172 VOID error_out_of_memory (VOID);
173 VOID error_syntax (LPTSTR);
174
175 VOID msg_pause (VOID);
176
177
178 /* prototypes for FILECOMP.C */
179 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
180 VOID CompleteFilename (LPTSTR, INT);
181 INT ShowCompletionMatches (LPTSTR, INT);
182 #endif
183 #ifdef FEATURE_4NT_FILENAME_COMPLETION
184 #endif
185
186
187 /* prototypes for HISTORY.C */
188 #ifdef FEATURE_HISTORY
189 VOID History (INT, LPTSTR);
190 #endif
191
192
193 /* prototypes for INTERNAL.C */
194 VOID InitLastPath (VOID);
195 VOID FreeLastPath (VOID);
196 int cmd_chdir(char *, char *);
197 int cmd_mkdir(char *, char *);
198 int cmd_rmdir(char *, char *);
199 int internal_exit(char *, char *);
200 int cmd_rem(char *, char *);
201 int cmd_showcommands(char *, char *);
202
203
204 /* prototyped for LABEL.C */
205 INT cmd_label (LPTSTR, LPTSTR);
206
207
208 /* prototypes for LOCALE.C */
209 extern TCHAR cDateSeparator;
210 extern INT nDateFormat;
211 extern TCHAR cTimeSeparator;
212 extern INT nTimeFormat;
213 extern TCHAR aszDayNames[7][8];
214 extern TCHAR cThousandSeparator;
215 extern TCHAR cDecimalSeparator;
216 extern INT nNumberGroups;
217
218 VOID InitLocale (VOID);
219
220
221 /* Prototypes for MISC.C */
222 TCHAR cgetchar (VOID);
223 BOOL CheckCtrlBreak (INT);
224 LPTSTR *split (LPTSTR, LPINT);
225 VOID freep (LPTSTR *);
226 LPTSTR stpcpy (LPTSTR, LPTSTR);
227 BOOL IsValidPathName (LPCTSTR);
228 BOOL IsValidFileName (LPCTSTR);
229 BOOL FileGetString (HANDLE, LPTSTR, INT);
230
231
232 /* prototypes for MOVE.C */
233 INT cmd_move (LPTSTR, LPTSTR);
234
235
236 /* prototypes from PATH.C */
237 INT cmd_path (LPTSTR, LPTSTR);
238
239
240 /* prototypes from PROMPT.C */
241 VOID PrintPrompt (VOID);
242 INT cmd_prompt (LPTSTR, LPTSTR);
243
244
245 /* prototypes for REDIR.C */
246 #define INPUT_REDIRECTION 1
247 #define OUTPUT_REDIRECTION 2
248 #define OUTPUT_APPEND 4
249 #define ERROR_REDIRECTION 8
250 #define ERROR_APPEND 16
251 INT GetRedirection (LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPINT);
252
253
254 /* prototypes for REN.C */
255 INT cmd_rename (LPTSTR, LPTSTR);
256
257
258 /* prototypes for SET.C */
259 INT cmd_set (LPTSTR, LPTSTR);
260
261
262 /* prototypes for TIME.C */
263 INT cmd_time (LPTSTR, LPTSTR);
264
265
266 /* prototypes for TYPE.C */
267 INT cmd_type (LPTSTR, LPTSTR);
268
269
270 /* prototypes for VER.C */
271 VOID ShortVersion (VOID);
272 INT cmd_ver (LPTSTR, LPTSTR);
273
274
275 /* prototypes for VERIFY.C */
276 INT cmd_verify (LPTSTR, LPTSTR);
277
278
279 /* prototypes for VOL.C */
280 INT cmd_vol (LPTSTR, LPTSTR);
281
282
283 /* prototypes for WHERE.C */
284 BOOL find_which (LPCTSTR, LPTSTR);
285
286
287
288
289 /* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
290 int cmd_call(char *, char *);
291 int cmd_echo(char *, char *);
292 int cmd_for(char *, char *);
293 int cmd_goto(char *, char *);
294 int cmd_if(char *, char *);
295 int cmd_pause(char *, char *);
296 int cmd_shift(char *, char *);
297
298 int cmd_beep(char *, char *);
299
300