1
0

cmds.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. cmds.c
  5. Abstract:
  6. This module implements the command table for the Swiss utility. These are
  7. the implemented commands for POSIX-like operating systems.
  8. Author:
  9. Evan Green 10-Mar-2015
  10. Environment:
  11. User Mode
  12. --*/
  13. //
  14. // ------------------------------------------------------------------- Includes
  15. //
  16. #include <minoca/lib/types.h>
  17. #include "swiss.h"
  18. //
  19. // ---------------------------------------------------------------- Definitions
  20. //
  21. //
  22. // ------------------------------------------------------ Data Type Definitions
  23. //
  24. //
  25. // ----------------------------------------------- Internal Function Prototypes
  26. //
  27. //
  28. // -------------------------------------------------------------------- Globals
  29. //
  30. SWISS_COMMAND_ENTRY SwissCommands[] = {
  31. {SH_COMMAND_NAME, SH_COMMAND_DESCRIPTION, ShMain, 0},
  32. {CAT_COMMAND_NAME, CAT_COMMAND_DESCRIPTION, CatMain, 0},
  33. {ECHO_COMMAND_NAME, ECHO_COMMAND_DESCRIPTION, EchoMain, 0},
  34. {TEST_COMMAND_NAME, TEST_COMMAND_DESCRIPTION, TestMain, 0},
  35. {TEST_COMMAND_NAME2, TEST_COMMAND_DESCRIPTON2, TestMain, 0},
  36. {MKDIR_COMMAND_NAME, MKDIR_COMMAND_DESCRIPTION, MkdirMain, 0},
  37. {LS_COMMAND_NAME, LS_COMMAND_DESCRIPTION, LsMain, 0},
  38. {RM_COMMAND_NAME, RM_COMMAND_DESCRIPTION, RmMain, 0},
  39. {RMDIR_COMMAND_NAME, RMDIR_COMMAND_DESCRIPTION, RmdirMain, 0},
  40. {MV_COMMAND_NAME, MV_COMMAND_DESCRIPTION, MvMain, 0},
  41. {CP_COMMAND_NAME, CP_COMMAND_DESCRIPTION, CpMain, 0},
  42. {SED_COMMAND_NAME, SED_COMMAND_DESCRIPTION, SedMain, 0},
  43. {PRINTF_COMMAND_NAME, PRINTF_COMMAND_DESCRIPTION, PrintfMain, 0},
  44. {EXPR_COMMAND_NAME, EXPR_COMMAND_DESCRIPTION, ExprMain, 0},
  45. {CHMOD_COMMAND_NAME, CHMOD_COMMAND_DESCRIPTION, ChmodMain, 0},
  46. {GREP_COMMAND_NAME, GREP_COMMAND_DESCRIPTION, GrepMain, 0},
  47. {EGREP_COMMAND_NAME, EGREP_COMMAND_DESCRIPTION, EgrepMain, 0},
  48. {FGREP_COMMAND_NAME, FGREP_COMMAND_DESCRIPTION, FgrepMain, 0},
  49. {UNAME_COMMAND_NAME, UNAME_COMMAND_DESCRIPTION, UnameMain, 0},
  50. {BASENAME_COMMAND_NAME, BASENAME_COMMAND_DESCRIPTION, BasenameMain, 0},
  51. {DIRNAME_COMMAND_NAME, DIRNAME_COMMAND_DESCRIPTION, DirnameMain, 0},
  52. {SORT_COMMAND_NAME, SORT_COMMAND_DESCRIPTION, SortMain, 0},
  53. {TR_COMMAND_NAME, TR_COMMAND_DESCRIPTION, TrMain, 0},
  54. {TOUCH_COMMAND_NAME, TOUCH_COMMAND_DESCRIPTION, TouchMain, 0},
  55. {TRUE_COMMAND_NAME, TRUE_COMMAND_DESCRIPTION, TrueMain, 0},
  56. {FALSE_COMMAND_NAME, FALSE_COMMAND_DESCRIPTION, FalseMain, 0},
  57. {PWD_COMMAND_NAME, PWD_COMMAND_DESCRIPTION, PwdMain, 0},
  58. {ENV_COMMAND_NAME, ENV_COMMAND_DESCRIPTION, EnvMain, 0},
  59. {FIND_COMMAND_NAME, FIND_COMMAND_DESCRIPTION, FindMain, 0},
  60. {CMP_COMMAND_NAME, CMP_COMMAND_DESCRIPTION, CmpMain, 0},
  61. {UNIQ_COMMAND_NAME, UNIQ_COMMAND_DESCRIPTION, UniqMain, 0},
  62. {DIFF_COMMAND_NAME, DIFF_COMMAND_DESCRIPTION, DiffMain, 0},
  63. {DATE_COMMAND_NAME, DATE_COMMAND_DESCRIPTION, DateMain, 0},
  64. {OD_COMMAND_NAME, OD_COMMAND_DESCRIPTION, OdMain, 0},
  65. {SLEEP_COMMAND_NAME, SLEEP_COMMAND_DESCRIPTION, SleepMain, 0},
  66. {MKTEMP_COMMAND_NAME, MKTEMP_COMMAND_DESCRIPTION, MktempMain, 0},
  67. {TAIL_COMMAND_NAME, TAIL_COMMAND_DESCRIPTION, TailMain, 0},
  68. {WC_COMMAND_NAME, WC_COMMAND_DESCRIPTION, WcMain, 0},
  69. {LN_COMMAND_NAME, LN_COMMAND_DESCRIPTION, LnMain, 0},
  70. {TIME_COMMAND_NAME, TIME_COMMAND_DESCRIPTION, TimeMain, 0},
  71. {CECHO_COMMAND_NAME, CECHO_COMMAND_DESCRIPTION, ColorEchoMain, 0},
  72. {CUT_COMMAND_NAME, CUT_COMMAND_DESCRIPTION, CutMain, 0},
  73. {SPLIT_COMMAND_NAME, SPLIT_COMMAND_DESCRIPTION, SplitMain, 0},
  74. {PS_COMMAND_NAME, PS_COMMAND_DESCRIPTION, PsMain, 0},
  75. {KILL_COMMAND_NAME, KILL_COMMAND_DESCRIPTION, KillMain, 0},
  76. {COMM_COMMAND_NAME, COMM_COMMAND_DESCRIPTION, CommMain, 0},
  77. {REBOOT_COMMAND_NAME, REBOOT_COMMAND_DESCRIPTION, RebootMain, 0},
  78. {ID_COMMAND_NAME, ID_COMMAND_DESCRIPTION, IdMain, 0},
  79. {CHROOT_COMMAND_NAME, CHROOT_COMMAND_DESCRIPTION, ChrootMain, 0},
  80. {CHOWN_COMMAND_NAME, CHOWN_COMMAND_DESCRIPTION, ChownMain, 0},
  81. {USERADD_COMMAND_NAME, USERADD_COMMAND_DESCRIPTION, UseraddMain, 0},
  82. {USERDEL_COMMAND_NAME, USERDEL_COMMAND_DESCRIPTION, UserdelMain, 0},
  83. {GROUPADD_COMMAND_NAME, GROUPADD_COMMAND_DESCRIPTION, GroupaddMain, 0},
  84. {GROUPDEL_COMMAND_NAME, GROUPDEL_COMMAND_DESCRIPTION, GroupdelMain, 0},
  85. {PASSWD_COMMAND_NAME,
  86. PASSWD_COMMAND_DESCRIPTION,
  87. PasswdMain,
  88. SWISS_APP_SETUID_OK},
  89. {VLOCK_COMMAND_NAME,
  90. VLOCK_COMMAND_DESCRIPTION,
  91. VlockMain,
  92. SWISS_APP_SETUID_OK},
  93. {SU_COMMAND_NAME, SU_COMMAND_DESCRIPTION, SuMain, SWISS_APP_SETUID_OK},
  94. {CHPASSWD_COMMAND_NAME, CHPASSWD_COMMAND_DESCRIPTION, ChpasswdMain, 0},
  95. {SULOGIN_COMMAND_NAME, SULOGIN_COMMAND_DESCRIPTION, SuloginMain, 0},
  96. {LOGIN_COMMAND_NAME, LOGIN_COMMAND_DESCRIPTION, LoginMain, 0},
  97. {GETTY_COMMAND_NAME, GETTY_COMMAND_DESCRIPTION, GettyMain, 0},
  98. {INIT_COMMAND_NAME, INIT_COMMAND_DESCRIPTION, InitMain, 0},
  99. {START_STOP_DAEMON_NAME, START_STOP_DAEMON_DESCRIPTION, SsDaemonMain, 0},
  100. {READLINK_COMMAND_NAME, READLINK_COMMAND_DESCRIPTION, ReadlinkMain, 0},
  101. {NL_COMMAND_NAME, NL_COMMAND_DESCRIPTION, NlMain, 0},
  102. {TEE_COMMAND_NAME, TEE_COMMAND_DESCRIPTION, TeeMain, 0},
  103. {INSTALL_COMMAND_NAME, INSTALL_COMMAND_DESCRIPTION, InstallMain, 0},
  104. {XARGS_COMMAND_NAME, XARGS_COMMAND_DESCRIPTION, XargsMain, 0},
  105. {SUM_COMMAND_NAME, SUM_COMMAND_DESCRIPTION, SumMain, 0},
  106. {HEAD_COMMAND_NAME, HEAD_COMMAND_DESCRIPTION, HeadMain, 0},
  107. {DD_COMMAND_NAME, DD_COMMAND_DESCRIPTION, DdMain, 0},
  108. {MKFIFO_COMMAND_NAME, MKFIFO_COMMAND_DESCRIPTION, MkfifoMain, 0},
  109. {DW_COMMAND_NAME, DW_COMMAND_DESCRIPTION, DwMain, SWISS_APP_HIDDEN},
  110. {TELNETD_COMMAND_NAME, TELNETD_COMMAND_DESCRIPTION, TelnetdMain, 0},
  111. {TELNET_COMMAND_NAME, TELNET_COMMAND_DESCRIPTION, TelnetMain, 0},
  112. {NPROC_COMMAND_NAME, NPROC_COMMAND_DESCRIPTION, NprocMain, 0},
  113. {SEQ_COMMAND_NAME, SEQ_COMMAND_DESCRIPTION, SeqMain, 0},
  114. {STTY_COMMAND_NAME, STTY_COMMAND_DESCRIPTION, SttyMain, 0},
  115. {NULL, NULL, NULL, 0},
  116. };
  117. //
  118. // ------------------------------------------------------------------ Functions
  119. //
  120. //
  121. // --------------------------------------------------------- Internal Functions
  122. //