cmd update:
[reactos.git] / reactos / subsys / system / cmd / cmdtable.c
1 /*
2 * CMDTABLE.C - table of internal commands.
3 *
4 *
5 * History:
6 *
7 * 16 Jul 1998 (Hans B Pufal)
8 * started.
9 * New file to keep the internal command table. I plan on
10 * getting rid of the table real soon now and replacing it
11 * with a dynamic mechnism.
12 *
13 * 27 Jul 1998 John P. Price
14 * added config.h include
15 *
16 * 21-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
17 * Unicode ready!
18 */
19
20 #include "precomp.h"
21 #include "resource.h"
22
23
24 /* a list of all the internal commands, associating their command names */
25 /* to the functions to process them */
26
27
28 COMMAND cmds[] =
29 {
30 {_T("?"), 0, CommandShowCommands},
31
32
33 #ifdef INCLUDE_CMD_ACTIVATE
34 {_T("activate"), 0, CommandActivate},
35 #endif
36
37 #ifdef FEATURE_ALIASES
38 {_T("alias"), 0, CommandAlias},
39 #endif
40
41 #ifdef INCLUDE_CMD_ATTRIB
42 {_T("attrib"), 0, CommandAttrib},
43 #endif
44
45 #ifdef INCLUDE_CMD_BEEP
46 {_T("beep"), 0, cmd_beep},
47 #endif
48
49 {_T("call"), CMD_BATCHONLY, cmd_call},
50
51 #ifdef INCLUDE_CMD_CHDIR
52 {_T("cd"), CMD_SPECIAL, cmd_chdir},
53 {_T("chdir"), CMD_SPECIAL, cmd_chdir},
54 #endif
55
56 #ifdef INCLUDE_CMD_CHCP
57 {_T("chcp"), 0, CommandChcp},
58 #endif
59
60 #ifdef INCLUDE_CMD_CHOICE
61 {_T("choice"), 0, CommandChoice},
62 #endif
63
64 #ifdef INCLUDE_CMD_CLS
65 {_T("cls"), 0, cmd_cls},
66 #endif
67
68 #ifdef INCLUDE_CMD_COLOR
69 {_T("color"), 0, CommandColor},
70 #endif
71
72 #ifdef INCLUDE_CMD_COPY
73 {_T("copy"), 0, cmd_copy},
74 #endif
75
76 #ifdef INCLUDE_CMD_DATE
77 {_T("date"), 0, cmd_date},
78 #endif
79
80 #ifdef INCLUDE_CMD_DEL
81 {_T("del"), 0, CommandDelete},
82 {_T("delete"), 0, CommandDelete},
83 #endif
84
85 #ifdef INCLUDE_CMD_DELAY
86 {_T("delay"), 0, CommandDelay},
87 #endif
88
89 #ifdef INCLUDE_CMD_DIR
90 {_T("dir"), CMD_SPECIAL, CommandDir},
91 #endif
92
93 #ifdef FEATURE_DIRECTORY_STACK
94 {_T("dirs"), 0, CommandDirs},
95 #endif
96
97 {_T("echo"), 0, CommandEcho},
98 {_T("echo."), CMD_HIDE, CommandEcho},
99 {_T("echos"), 0, CommandEchos},
100 {_T("echoerr"), 0, CommandEchoerr},
101 {_T("echoerr."), CMD_HIDE, CommandEchoerr},
102 {_T("echoserr"), 0, CommandEchoserr},
103
104 #ifdef INCLUDE_CMD_DEL
105 {_T("erase"), 0, CommandDelete},
106 #endif
107
108 {_T("exit"), 0, CommandExit},
109
110 {_T("for"), 0, cmd_for},
111
112 #ifdef INCLUDE_CMD_FREE
113 {_T("free"), 0, CommandFree},
114 #endif
115
116 {_T("goto"), CMD_BATCHONLY, cmd_goto},
117
118 {_T("help"), 0, CommandShowCommandsDetail},
119
120 #ifdef FEATURE_HISTORY
121 {_T("history"), 0, CommandHistory},
122 #endif
123
124 {_T("if"), 0, cmd_if},
125
126 #ifdef INCLUDE_CMD_LABEL
127 {_T("label"), 0, cmd_label},
128 #endif
129
130 #ifdef INCLUDE_CMD_MEMORY
131 {_T("memory"), 0, CommandMemory},
132 #endif
133
134 #ifdef INCLUDE_CMD_MKDIR
135 {_T("md"), CMD_SPECIAL, cmd_mkdir},
136 {_T("mkdir"), CMD_SPECIAL, cmd_mkdir},
137 #endif
138
139 #ifdef INCLUDE_CMD_MOVE
140 {_T("move"), 0, cmd_move},
141 #endif
142
143 #ifdef INCLUDE_CMD_MSGBOX
144 {_T("msgbox"), 0, CommandMsgbox},
145 #endif
146
147 #ifdef INCLUDE_CMD_PATH
148 {_T("path"), 0, cmd_path},
149 #endif
150
151 #ifdef INCLUDE_CMD_PAUSE
152 {_T("pause"), 0, cmd_pause},
153 #endif
154
155 #ifdef FEATURE_DIRECTORY_STACK
156 {_T("popd"), 0, CommandPopd},
157 #endif
158
159 #ifdef INCLUDE_CMD_PROMPT
160 {_T("prompt"), 0, cmd_prompt},
161 #endif
162
163 #ifdef FEATURE_DIRECTORY_STACK
164 {_T("pushd"), 0, CommandPushd},
165 #endif
166
167 #ifdef INCLUDE_CMD_RMDIR
168 {_T("rd"), CMD_SPECIAL, cmd_rmdir},
169 #endif
170
171 #ifdef INCLUDE_CMD_REM
172 {_T("rem"), 0, CommandRem},
173 #endif
174
175 #ifdef INCLUDE_CMD_RENAME
176 {_T("ren"), 0, cmd_rename},
177 {_T("rename"), 0, cmd_rename},
178 #endif
179
180 #ifdef INCLUDE_CMD_RMDIR
181 {_T("rmdir"), CMD_SPECIAL, cmd_rmdir},
182 #endif
183
184 #ifdef INCLUDE_CMD_SCREEN
185 {_T("screen"), 0, CommandScreen},
186 #endif
187
188 #ifdef INCLUDE_CMD_SET
189 {_T("set"), 0, cmd_set},
190 #endif
191
192 {_T("shift"), CMD_BATCHONLY, cmd_shift},
193
194 #ifdef INCLUDE_CMD_START
195 {_T("start"), 0, cmd_start},
196 #endif
197
198 #ifdef INCLUDE_CMD_TIME
199 {_T("time"), 0, cmd_time},
200 #endif
201
202 #ifdef INCLUDE_CMD_TIMER
203 {_T("timer"), 0, CommandTimer},
204 #endif
205
206 #ifdef INCLUDE_CMD_TITLE
207 {_T("title"), 0, cmd_title},
208 #endif
209
210 #ifdef INCLUDE_CMD_TYPE
211 {_T("type"), 0, cmd_type},
212 #endif
213
214 #ifdef INCLUDE_CMD_VER
215 {_T("ver"), 0, cmd_ver},
216 #endif
217
218 #ifdef INCLUDE_CMD_VERIFY
219 {_T("verify"), 0, cmd_verify},
220 #endif
221
222 #ifdef INCLUDE_CMD_VOL
223 {_T("vol"), 0, cmd_vol},
224 #endif
225
226 #ifdef INCLUDE_CMD_WINDOW
227 {_T("window"), 0, CommandWindow},
228 #endif
229
230 {NULL, 0, NULL}
231 };
232
233
234 VOID PrintCommandList (VOID)
235 {
236 LPCOMMAND cmdptr;
237 INT y;
238
239 y = 0;
240 cmdptr = cmds;
241 while (cmdptr->name)
242 {
243 if (!(cmdptr->flags & CMD_HIDE))
244 {
245 if (++y == 8)
246 {
247 ConOutPuts (cmdptr->name);
248 y = 0;
249 }
250 else
251 {
252 ConOutPrintf (_T("%-10s"), cmdptr->name);
253 }
254 }
255
256 cmdptr++;
257 }
258
259 if (y != 0)
260 ConOutChar ('\n');
261 }
262
263 VOID PrintCommandListDetail (VOID)
264 {
265 ConOutResPuts(STRING_HELP1);
266 ConOutResPuts(STRING_HELP2);
267 }
268
269 /* EOF */