1999-03-20 20:28:42 +00:00
|
|
|
/*
|
|
|
|
* CMDTABLE.C - table of internal commands.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* History:
|
|
|
|
*
|
|
|
|
* 16 Jul 1998 (Hans B Pufal)
|
|
|
|
* started.
|
|
|
|
* New file to keep the internal command table. I plan on
|
|
|
|
* getting rid of the table real soon now and replacing it
|
|
|
|
* with a dynamic mechnism.
|
|
|
|
*
|
|
|
|
* 27 Jul 1998 John P. Price
|
|
|
|
* added config.h include
|
|
|
|
*
|
|
|
|
* 21-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
|
|
|
* Unicode ready!
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <tchar.h>
|
|
|
|
|
|
|
|
#include "cmd.h"
|
|
|
|
|
|
|
|
/* a list of all the internal commands, associating their command names */
|
|
|
|
/* to the functions to process them */
|
|
|
|
|
|
|
|
|
|
|
|
COMMAND cmds[] =
|
|
|
|
{
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("?"), 0, CommandShowCommands},
|
1999-03-20 20:28:42 +00:00
|
|
|
|
1999-10-03 22:20:33 +00:00
|
|
|
#ifdef INCLUDE_CMD_ACTIVATE
|
1999-11-04 11:29:36 +00:00
|
|
|
{_T("activate"), 0, CommandActivate},
|
1999-10-03 22:20:33 +00:00
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
#ifdef FEATURE_ALIASES
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("alias"), 0, CommandAlias},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_ATTRIB
|
1999-11-04 11:29:36 +00:00
|
|
|
{_T("attrib"), 0, CommandAttrib},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_BEEP
|
|
|
|
{_T("beep"), 0, cmd_beep},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
{_T("call"), CMD_BATCHONLY, cmd_call},
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_CHDIR
|
|
|
|
{_T("cd"), CMD_SPECIAL, cmd_chdir},
|
|
|
|
{_T("chdir"), CMD_SPECIAL, cmd_chdir},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_CHCP
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("chcp"), 0, CommandChcp},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
1999-08-21 21:54:30 +00:00
|
|
|
#ifdef INCLUDE_CMD_CHOICE
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("choice"), 0, CommandChoice},
|
1999-08-21 21:54:30 +00:00
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
#ifdef INCLUDE_CMD_CLS
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("cls"), 0, cmd_cls},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_COLOR
|
1999-11-04 11:29:36 +00:00
|
|
|
{_T("color"), 0, CommandColor},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_COPY
|
|
|
|
{_T("copy"), 0, cmd_copy},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_DATE
|
|
|
|
{_T("date"), 0, cmd_date},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_DEL
|
1999-11-04 11:29:36 +00:00
|
|
|
{_T("del"), 0, CommandDelete},
|
|
|
|
{_T("delete"), 0, CommandDelete},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
1999-09-12 18:23:31 +00:00
|
|
|
#ifdef INCLUDE_CMD_DELAY
|
|
|
|
{_T("delay"), 0, CommandDelay},
|
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
#ifdef INCLUDE_CMD_DIR
|
1999-12-15 00:50:41 +00:00
|
|
|
{_T("dir"), CMD_SPECIAL, CommandDir},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
1999-10-23 18:17:37 +00:00
|
|
|
#ifdef FEATURE_DIRECTORY_STACK
|
1999-11-04 11:29:36 +00:00
|
|
|
{_T("dirs"), 0, CommandDirs},
|
1999-10-23 18:17:37 +00:00
|
|
|
#endif
|
|
|
|
|
1999-10-03 22:20:33 +00:00
|
|
|
{_T("echo"), 0, CommandEcho},
|
2000-07-19 06:58:13 +00:00
|
|
|
{_T("echo."), CMD_HIDE, CommandEcho},
|
1999-10-03 22:20:33 +00:00
|
|
|
{_T("echos"), 0, CommandEchos},
|
|
|
|
{_T("echoerr"), 0, CommandEchoerr},
|
2000-07-19 06:58:13 +00:00
|
|
|
{_T("echoerr."), CMD_HIDE, CommandEchoerr},
|
1999-10-03 22:20:33 +00:00
|
|
|
{_T("echoserr"), 0, CommandEchoserr},
|
1999-03-20 20:28:42 +00:00
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_DEL
|
1999-10-23 18:17:37 +00:00
|
|
|
{_T("erase"), 0, CommandDelete},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
1999-10-03 22:20:33 +00:00
|
|
|
{_T("exit"), 0, CommandExit},
|
1999-03-20 20:28:42 +00:00
|
|
|
|
|
|
|
{_T("for"), 0, cmd_for},
|
|
|
|
|
1999-09-12 18:23:31 +00:00
|
|
|
#ifdef INCLUDE_CMD_FREE
|
|
|
|
{_T("free"), 0, CommandFree},
|
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
{_T("goto"), CMD_BATCHONLY, cmd_goto},
|
|
|
|
|
2000-02-01 18:29:11 +00:00
|
|
|
#ifdef FEATURE_HISTORY
|
|
|
|
{_T("history"), 0, CommandHistory},
|
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
{_T("if"), 0, cmd_if},
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_LABEL
|
|
|
|
{_T("label"), 0, cmd_label},
|
|
|
|
#endif
|
|
|
|
|
1999-09-12 18:23:31 +00:00
|
|
|
#ifdef INCLUDE_CMD_MEMORY
|
|
|
|
{_T("memory"), 0, CommandMemory},
|
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
#ifdef INCLUDE_CMD_MKDIR
|
|
|
|
{_T("md"), CMD_SPECIAL, cmd_mkdir},
|
|
|
|
{_T("mkdir"), CMD_SPECIAL, cmd_mkdir},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_MOVE
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("move"), 0, cmd_move},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
1999-08-29 22:31:43 +00:00
|
|
|
#ifdef INCLUDE_CMD_MSGBOX
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("msgbox"), 0, CommandMsgbox},
|
1999-08-29 22:31:43 +00:00
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
#ifdef INCLUDE_CMD_PATH
|
|
|
|
{_T("path"), 0, cmd_path},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_PAUSE
|
|
|
|
{_T("pause"), 0, cmd_pause},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEATURE_DIRECTORY_STACK
|
1999-10-03 22:20:33 +00:00
|
|
|
{_T("popd"), 0, CommandPopd},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_PROMPT
|
|
|
|
{_T("prompt"), 0, cmd_prompt},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEATURE_DIRECTORY_STACK
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("pushd"), 0, CommandPushd},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_RMDIR
|
|
|
|
{_T("rd"), CMD_SPECIAL, cmd_rmdir},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_REM
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("rem"), 0, CommandRem},
|
1999-03-20 20:28:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_RENAME
|
|
|
|
{_T("ren"), 0, cmd_rename},
|
|
|
|
{_T("rename"), 0, cmd_rename},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_RMDIR
|
|
|
|
{_T("rmdir"), CMD_SPECIAL, cmd_rmdir},
|
|
|
|
#endif
|
|
|
|
|
1999-09-12 18:23:31 +00:00
|
|
|
#ifdef INCLUDE_CMD_SCREEN
|
|
|
|
{_T("screen"), 0, CommandScreen},
|
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
#ifdef INCLUDE_CMD_SET
|
|
|
|
{_T("set"), 0, cmd_set},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
{_T("shift"), CMD_BATCHONLY, cmd_shift},
|
|
|
|
|
1999-07-24 17:18:05 +00:00
|
|
|
#ifdef INCLUDE_CMD_START
|
|
|
|
{_T("start"), 0, cmd_start},
|
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
#ifdef INCLUDE_CMD_TIME
|
|
|
|
{_T("time"), 0, cmd_time},
|
|
|
|
#endif
|
|
|
|
|
1999-08-29 22:31:43 +00:00
|
|
|
#ifdef INCLUDE_CMD_TIMER
|
1999-09-12 18:23:31 +00:00
|
|
|
{_T("timer"), 0, CommandTimer},
|
1999-08-29 22:31:43 +00:00
|
|
|
#endif
|
|
|
|
|
1999-03-21 21:32:45 +00:00
|
|
|
#ifdef INCLUDE_CMD_TITLE
|
|
|
|
{_T("title"), 0, cmd_title},
|
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
#ifdef INCLUDE_CMD_TYPE
|
|
|
|
{_T("type"), 0, cmd_type},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_VER
|
|
|
|
{_T("ver"), 0, cmd_ver},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_VERIFY
|
|
|
|
{_T("verify"), 0, cmd_verify},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INCLUDE_CMD_VOL
|
|
|
|
{_T("vol"), 0, cmd_vol},
|
|
|
|
#endif
|
|
|
|
|
1999-09-24 22:03:11 +00:00
|
|
|
#ifdef INCLUDE_CMD_WINDOW
|
1999-10-03 22:20:33 +00:00
|
|
|
{_T("window"), 0, CommandWindow},
|
1999-09-24 22:03:11 +00:00
|
|
|
#endif
|
|
|
|
|
1999-03-20 20:28:42 +00:00
|
|
|
{NULL, 0, NULL}
|
|
|
|
};
|
|
|
|
|
2000-07-19 06:58:13 +00:00
|
|
|
|
|
|
|
VOID PrintCommandList (VOID)
|
|
|
|
{
|
|
|
|
LPCOMMAND cmdptr;
|
|
|
|
INT y;
|
|
|
|
|
|
|
|
y = 0;
|
|
|
|
cmdptr = cmds;
|
|
|
|
while (cmdptr->name)
|
|
|
|
{
|
|
|
|
if (!(cmdptr->flags & CMD_HIDE))
|
|
|
|
{
|
|
|
|
if (++y == 8)
|
|
|
|
{
|
|
|
|
ConOutPuts (cmdptr->name);
|
|
|
|
y = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ConOutPrintf (_T("%-10s"), cmdptr->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cmdptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (y != 0)
|
|
|
|
ConOutChar ('\n');
|
|
|
|
}
|
|
|
|
|
1999-09-12 18:23:31 +00:00
|
|
|
/* EOF */
|