ReactOS  0.4.14-dev-614-gbfd8a84
cmdtable.c
Go to the documentation of this file.
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 
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 
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 */
INT cmd_mklink(LPTSTR)
Definition: mklink.c:124
int cmd_shift(TCHAR *)
INT CommandTimer(LPTSTR param)
Definition: timer.c:59
INT CommandHistory(LPTSTR param)
Definition: history.c:71
INT cmd_rmdir(LPTSTR)
Definition: internal.c:408
INT cmd_start(LPTSTR)
Definition: start.c:37
VOID ConOutChar(TCHAR c)
Definition: console.c:123
INT cmd_goto(LPTSTR)
Definition: goto.c:39
INT CommandActivate(LPTSTR)
INT cmd_date(LPTSTR)
Definition: date.c:176
#define CMD_HIDE
Definition: cmd.h:109
INT CommandDirs(LPTSTR)
Definition: dirstack.c:154
INT cmd_copy(LPTSTR)
Definition: copy.c:331
INT cmd_endlocal(LPTSTR)
Definition: setlocal.c:95
INT CommandFree(LPTSTR)
Definition: free.c:86
#define ConOutPrintf(szStr,...)
Definition: console.h:42
INT cmd_type(LPTSTR)
Definition: type.c:34
INT cmd_path(LPTSTR)
Definition: path.c:36
INT CommandRem(LPTSTR)
Definition: internal.c:559
INT flags
Definition: cmdcons.c:28
int32_t INT
Definition: typedefs.h:56
INT CommandMsgbox(LPTSTR)
INT CommandEchoerr(LPTSTR)
Definition: echo.c:106
INT cmd_mkdir(LPTSTR)
Definition: internal.c:324
INT cmd_move(LPTSTR)
Definition: move.c:87
INT CommandMemory(LPTSTR)
Definition: memory.c:18
INT cmd_replace(LPTSTR)
Definition: replace.c:392
smooth NULL
Definition: ftsmooth.c:416
INT cmd_setlocal(LPTSTR)
Definition: setlocal.c:39
INT cmd_chdir(LPTSTR)
Definition: internal.c:219
INT cmd_time(LPTSTR)
Definition: time.c:132
INT cmd_for(LPTSTR)
Definition: for.c:37
#define CMD_BATCHONLY
Definition: cmd.h:108
#define _T(x)
Definition: vfdio.h:22
INT CommandPushd(LPTSTR)
Definition: dirstack.c:107
INT cmd_beep(LPTSTR param)
Definition: beep.c:31
INT cmd_title(LPTSTR)
Definition: title.c:18
INT CommandAlias(LPTSTR param)
Definition: alias.c:174
COMMAND cmds[]
Definition: cmdtable.c:28
INT CommandShowCommands(LPTSTR)
Definition: internal.c:571
INT CommandScreen(LPTSTR)
Definition: screen.c:18
INT cmd_cls(LPTSTR param)
Definition: cls.c:33
INT cmd_set(LPTSTR)
Definition: set.c:73
INT CommandWindow(LPTSTR)
INT CommandPopd(LPTSTR)
Definition: dirstack.c:132
int cmd_if(TCHAR *)
int cmd_pause(TCHAR *)
INT cmd_verify(LPTSTR)
Definition: verify.c:30
INT cmd_ver(LPTSTR)
Definition: ver.c:126
INT CommandDelete(LPTSTR)
Definition: del.c:358
INT CommandChoice(LPTSTR param)
Definition: choice.c:102
INT CommandEchoserr(LPTSTR)
Definition: echo.c:121
INT cmd_call(LPTSTR param)
Definition: call.c:37
INT CommandDir(LPTSTR)
Definition: dir.c:1828
INT cmd_rename(LPTSTR)
Definition: ren.c:53
#define CMD_SPECIAL
Definition: cmd.h:107
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
INT cmd_ctty(LPTSTR)
Definition: ctty.c:102
INT cmd_prompt(LPTSTR)
Definition: prompt.c:231
INT CommandEcho(LPTSTR)
Definition: echo.c:65
LPSTR name
Definition: cmdcons.c:27
INT CommandDelay(LPTSTR)
Definition: delay.c:17
INT CommandEchos(LPTSTR)
Definition: echo.c:91
static INT CommandExit(PCONSOLE_STATE State, LPSTR param)
Definition: cmdcons.c:490
VOID PrintCommandList(VOID)
Definition: cmdtable.c:234
INT CommandAssoc(LPTSTR param)
Definition: assoc.c:190
Definition: main.c:14
INT cmd_vol(LPTSTR)
Definition: vol.c:64
VOID ConOutPuts(LPTSTR szText)
Definition: tee.c:27
INT CommandColor(LPTSTR)
Definition: color.c:32