123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- /*++
- Copyright (c) 2015 Minoca Corp. All Rights Reserved
- Module Name:
- cmds.c
- Abstract:
- This module implements the command table for the Swiss utility. These are
- the implemented commands for POSIX-like operating systems.
- Author:
- Evan Green 10-Mar-2015
- Environment:
- User Mode
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- #include <minoca/lib/types.h>
- #include "swiss.h"
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- //
- // ----------------------------------------------- Internal Function Prototypes
- //
- //
- // -------------------------------------------------------------------- Globals
- //
- SWISS_COMMAND_ENTRY SwissCommands[] = {
- {SH_COMMAND_NAME, SH_COMMAND_DESCRIPTION, ShMain, 0},
- {CAT_COMMAND_NAME, CAT_COMMAND_DESCRIPTION, CatMain, 0},
- {ECHO_COMMAND_NAME, ECHO_COMMAND_DESCRIPTION, EchoMain, 0},
- {TEST_COMMAND_NAME, TEST_COMMAND_DESCRIPTION, TestMain, 0},
- {TEST_COMMAND_NAME2, TEST_COMMAND_DESCRIPTON2, TestMain, 0},
- {MKDIR_COMMAND_NAME, MKDIR_COMMAND_DESCRIPTION, MkdirMain, 0},
- {LS_COMMAND_NAME, LS_COMMAND_DESCRIPTION, LsMain, 0},
- {RM_COMMAND_NAME, RM_COMMAND_DESCRIPTION, RmMain, 0},
- {RMDIR_COMMAND_NAME, RMDIR_COMMAND_DESCRIPTION, RmdirMain, 0},
- {MV_COMMAND_NAME, MV_COMMAND_DESCRIPTION, MvMain, 0},
- {CP_COMMAND_NAME, CP_COMMAND_DESCRIPTION, CpMain, 0},
- {SED_COMMAND_NAME, SED_COMMAND_DESCRIPTION, SedMain, 0},
- {PRINTF_COMMAND_NAME, PRINTF_COMMAND_DESCRIPTION, PrintfMain, 0},
- {EXPR_COMMAND_NAME, EXPR_COMMAND_DESCRIPTION, ExprMain, 0},
- {CHMOD_COMMAND_NAME, CHMOD_COMMAND_DESCRIPTION, ChmodMain, 0},
- {GREP_COMMAND_NAME, GREP_COMMAND_DESCRIPTION, GrepMain, 0},
- {EGREP_COMMAND_NAME, EGREP_COMMAND_DESCRIPTION, EgrepMain, 0},
- {FGREP_COMMAND_NAME, FGREP_COMMAND_DESCRIPTION, FgrepMain, 0},
- {UNAME_COMMAND_NAME, UNAME_COMMAND_DESCRIPTION, UnameMain, 0},
- {BASENAME_COMMAND_NAME, BASENAME_COMMAND_DESCRIPTION, BasenameMain, 0},
- {DIRNAME_COMMAND_NAME, DIRNAME_COMMAND_DESCRIPTION, DirnameMain, 0},
- {SORT_COMMAND_NAME, SORT_COMMAND_DESCRIPTION, SortMain, 0},
- {TR_COMMAND_NAME, TR_COMMAND_DESCRIPTION, TrMain, 0},
- {TOUCH_COMMAND_NAME, TOUCH_COMMAND_DESCRIPTION, TouchMain, 0},
- {TRUE_COMMAND_NAME, TRUE_COMMAND_DESCRIPTION, TrueMain, 0},
- {FALSE_COMMAND_NAME, FALSE_COMMAND_DESCRIPTION, FalseMain, 0},
- {PWD_COMMAND_NAME, PWD_COMMAND_DESCRIPTION, PwdMain, 0},
- {ENV_COMMAND_NAME, ENV_COMMAND_DESCRIPTION, EnvMain, 0},
- {FIND_COMMAND_NAME, FIND_COMMAND_DESCRIPTION, FindMain, 0},
- {CMP_COMMAND_NAME, CMP_COMMAND_DESCRIPTION, CmpMain, 0},
- {UNIQ_COMMAND_NAME, UNIQ_COMMAND_DESCRIPTION, UniqMain, 0},
- {DIFF_COMMAND_NAME, DIFF_COMMAND_DESCRIPTION, DiffMain, 0},
- {DATE_COMMAND_NAME, DATE_COMMAND_DESCRIPTION, DateMain, 0},
- {OD_COMMAND_NAME, OD_COMMAND_DESCRIPTION, OdMain, 0},
- {SLEEP_COMMAND_NAME, SLEEP_COMMAND_DESCRIPTION, SleepMain, 0},
- {MKTEMP_COMMAND_NAME, MKTEMP_COMMAND_DESCRIPTION, MktempMain, 0},
- {TAIL_COMMAND_NAME, TAIL_COMMAND_DESCRIPTION, TailMain, 0},
- {WC_COMMAND_NAME, WC_COMMAND_DESCRIPTION, WcMain, 0},
- {LN_COMMAND_NAME, LN_COMMAND_DESCRIPTION, LnMain, 0},
- {TIME_COMMAND_NAME, TIME_COMMAND_DESCRIPTION, TimeMain, 0},
- {CECHO_COMMAND_NAME, CECHO_COMMAND_DESCRIPTION, ColorEchoMain, 0},
- {CUT_COMMAND_NAME, CUT_COMMAND_DESCRIPTION, CutMain, 0},
- {SPLIT_COMMAND_NAME, SPLIT_COMMAND_DESCRIPTION, SplitMain, 0},
- {PS_COMMAND_NAME, PS_COMMAND_DESCRIPTION, PsMain, 0},
- {KILL_COMMAND_NAME, KILL_COMMAND_DESCRIPTION, KillMain, 0},
- {COMM_COMMAND_NAME, COMM_COMMAND_DESCRIPTION, CommMain, 0},
- {REBOOT_COMMAND_NAME, REBOOT_COMMAND_DESCRIPTION, RebootMain, 0},
- {ID_COMMAND_NAME, ID_COMMAND_DESCRIPTION, IdMain, 0},
- {CHROOT_COMMAND_NAME, CHROOT_COMMAND_DESCRIPTION, ChrootMain, 0},
- {CHOWN_COMMAND_NAME, CHOWN_COMMAND_DESCRIPTION, ChownMain, 0},
- {USERADD_COMMAND_NAME, USERADD_COMMAND_DESCRIPTION, UseraddMain, 0},
- {USERDEL_COMMAND_NAME, USERDEL_COMMAND_DESCRIPTION, UserdelMain, 0},
- {GROUPADD_COMMAND_NAME, GROUPADD_COMMAND_DESCRIPTION, GroupaddMain, 0},
- {GROUPDEL_COMMAND_NAME, GROUPDEL_COMMAND_DESCRIPTION, GroupdelMain, 0},
- {PASSWD_COMMAND_NAME,
- PASSWD_COMMAND_DESCRIPTION,
- PasswdMain,
- SWISS_APP_SETUID_OK},
- {VLOCK_COMMAND_NAME,
- VLOCK_COMMAND_DESCRIPTION,
- VlockMain,
- SWISS_APP_SETUID_OK},
- {SU_COMMAND_NAME, SU_COMMAND_DESCRIPTION, SuMain, SWISS_APP_SETUID_OK},
- {CHPASSWD_COMMAND_NAME, CHPASSWD_COMMAND_DESCRIPTION, ChpasswdMain, 0},
- {SULOGIN_COMMAND_NAME, SULOGIN_COMMAND_DESCRIPTION, SuloginMain, 0},
- {LOGIN_COMMAND_NAME, LOGIN_COMMAND_DESCRIPTION, LoginMain, 0},
- {GETTY_COMMAND_NAME, GETTY_COMMAND_DESCRIPTION, GettyMain, 0},
- {INIT_COMMAND_NAME, INIT_COMMAND_DESCRIPTION, InitMain, 0},
- {START_STOP_DAEMON_NAME, START_STOP_DAEMON_DESCRIPTION, SsDaemonMain, 0},
- {READLINK_COMMAND_NAME, READLINK_COMMAND_DESCRIPTION, ReadlinkMain, 0},
- {NL_COMMAND_NAME, NL_COMMAND_DESCRIPTION, NlMain, 0},
- {TEE_COMMAND_NAME, TEE_COMMAND_DESCRIPTION, TeeMain, 0},
- {INSTALL_COMMAND_NAME, INSTALL_COMMAND_DESCRIPTION, InstallMain, 0},
- {XARGS_COMMAND_NAME, XARGS_COMMAND_DESCRIPTION, XargsMain, 0},
- {SUM_COMMAND_NAME, SUM_COMMAND_DESCRIPTION, SumMain, 0},
- {HEAD_COMMAND_NAME, HEAD_COMMAND_DESCRIPTION, HeadMain, 0},
- {DD_COMMAND_NAME, DD_COMMAND_DESCRIPTION, DdMain, 0},
- {MKFIFO_COMMAND_NAME, MKFIFO_COMMAND_DESCRIPTION, MkfifoMain, 0},
- {DW_COMMAND_NAME, DW_COMMAND_DESCRIPTION, DwMain, SWISS_APP_HIDDEN},
- {TELNETD_COMMAND_NAME, TELNETD_COMMAND_DESCRIPTION, TelnetdMain, 0},
- {TELNET_COMMAND_NAME, TELNET_COMMAND_DESCRIPTION, TelnetMain, 0},
- {NPROC_COMMAND_NAME, NPROC_COMMAND_DESCRIPTION, NprocMain, 0},
- {SEQ_COMMAND_NAME, SEQ_COMMAND_DESCRIPTION, SeqMain, 0},
- {STTY_COMMAND_NAME, STTY_COMMAND_DESCRIPTION, SttyMain, 0},
- {NULL, NULL, NULL, 0},
- };
- //
- // ------------------------------------------------------------------ Functions
- //
- //
- // --------------------------------------------------------- Internal Functions
- //
|