xref: /reactos/base/shell/cmd/cmdtable.c (revision 40462c92)
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 mechanism.
12  *
13  *    27 Jul 1998  John P. Price
14  *        added config.h include
15  *
16  *    21-Jan-1999 (Eric Kohl)
17  *        Unicode ready!
18  */
19 
20 #include "precomp.h"
21 
22 /*
23  * A list of all the internal commands, associating their command names
24  * to the functions to process them.
25  */
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_ASSOC
42     {_T("assoc"), 0, CommandAssoc},
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_CHOICE
57     {_T("choice"), 0, CommandChoice},
58 #endif
59 
60 #ifdef INCLUDE_CMD_CLS
61     {_T("cls"), 0, cmd_cls},
62 #endif
63 
64 #ifdef INCLUDE_CMD_COLOR
65     {_T("color"), 0, CommandColor},
66 #endif
67 
68 #ifdef INCLUDE_CMD_COPY
69     {_T("copy"),     0, cmd_copy},
70 #endif
71 
72 #ifdef INCLUDE_CMD_CTTY
73     {_T("ctty"),     0, cmd_ctty},
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"), CMD_SPECIAL, CommandEcho},
98     {_T("echos"), 0, CommandEchos},
99     {_T("echoerr"), CMD_SPECIAL, CommandEchoerr},
100     {_T("echoserr"), 0, CommandEchoserr},
101 
102     {_T("endlocal"), 0, cmd_endlocal},
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 #ifdef FEATURE_HISTORY
119     {_T("history"), 0, CommandHistory},
120 #endif
121 
122     {_T("if"), 0, cmd_if},
123 
124 #ifdef INCLUDE_CMD_MEMORY
125     {_T("memory"), 0, CommandMemory},
126 #endif
127 
128 #ifdef INCLUDE_CMD_MKDIR
129     {_T("md"), CMD_SPECIAL, cmd_mkdir},
130     {_T("mkdir"), CMD_SPECIAL, cmd_mkdir},
131 #endif
132 
133 #ifdef INCLUDE_CMD_MKLINK
134     {_T("mklink"), 0, cmd_mklink},
135 #endif
136 
137 #ifdef INCLUDE_CMD_MOVE
138     {_T("move"), 0, cmd_move},
139 #endif
140 
141 #ifdef INCLUDE_CMD_MSGBOX
142     {_T("msgbox"), 0, CommandMsgbox},
143 #endif
144 
145 #ifdef INCLUDE_CMD_PATH
146     {_T("path"), 0, cmd_path},
147 #endif
148 
149 #ifdef INCLUDE_CMD_PAUSE
150     {_T("pause"), 0, cmd_pause},
151 #endif
152 
153 #ifdef FEATURE_DIRECTORY_STACK
154     {_T("popd"), 0, CommandPopd},
155 #endif
156 
157 #ifdef INCLUDE_CMD_PROMPT
158     {_T("prompt"), 0, cmd_prompt},
159 #endif
160 
161 #ifdef FEATURE_DIRECTORY_STACK
162     {_T("pushd"), 0, CommandPushd},
163 #endif
164 
165 #ifdef INCLUDE_CMD_RMDIR
166     {_T("rd"), CMD_SPECIAL, cmd_rmdir},
167     {_T("rmdir"), CMD_SPECIAL, cmd_rmdir},
168 #endif
169 
170 #ifdef INCLUDE_CMD_REM
171     {_T("rem"), 0, CommandRem},
172 #endif
173 
174 #ifdef INCLUDE_CMD_RENAME
175     {_T("ren"), 0, cmd_rename},
176     {_T("rename"), 0, cmd_rename},
177 #endif
178 
179 #ifdef INCLUDE_CMD_REPLACE
180     {_T("replace"), 0, cmd_replace},
181 #endif
182 
183 #ifdef INCLUDE_CMD_SCREEN
184     {_T("screen"), 0, CommandScreen},
185 #endif
186 
187 #ifdef INCLUDE_CMD_SET
188     {_T("set"), 0, cmd_set},
189 #endif
190 
191     {_T("setlocal"), 0, cmd_setlocal},
192 
193     {_T("shift"), CMD_BATCHONLY, cmd_shift},
194 
195 #ifdef INCLUDE_CMD_START
196     {_T("start"), 0, cmd_start},
197 #endif
198 
199 #ifdef INCLUDE_CMD_TIME
200     {_T("time"), 0, cmd_time},
201 #endif
202 
203 #ifdef INCLUDE_CMD_TIMER
204     {_T("timer"), 0, CommandTimer},
205 #endif
206 
207 #ifdef INCLUDE_CMD_TITLE
208     {_T("title"), 0, cmd_title},
209 #endif
210 
211 #ifdef INCLUDE_CMD_TYPE
212     {_T("type"), 0, cmd_type},
213 #endif
214 
215 #ifdef INCLUDE_CMD_VER
216     {_T("ver"), 0, cmd_ver},
217 #endif
218 
219 #ifdef INCLUDE_CMD_VERIFY
220     {_T("verify"), 0, cmd_verify},
221 #endif
222 
223 #ifdef INCLUDE_CMD_VOL
224     {_T("vol"), 0, cmd_vol},
225 #endif
226 
227 #ifdef INCLUDE_CMD_WINDOW
228     {_T("window"), 0, CommandWindow},
229 #endif
230 
231     {NULL, 0, NULL}
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                 ConOutChar(_T('\n'));
249                 y = 0;
250             }
251             else
252             {
253                 ConOutPrintf (_T("%-10s"), cmdptr->name);
254             }
255         }
256 
257         cmdptr++;
258     }
259 
260     if (y != 0)
261         ConOutChar(_T('\n'));
262 }
263 
264 /* EOF */
265