Subversion Repositories Kolibri OS

Rev

Rev 959 | Rev 1668 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. #define SHELL_VERSION "0.4.4"
  3.  
  4. extern char     PATH[256];
  5. extern char     PARAM[256];
  6.  
  7. char            title[64];
  8. char            cur_dir[256];
  9.  
  10. /// ===========================================================
  11.  
  12. char            *ALIASES = NULL;
  13. unsigned        ALIAS_NUM = 0;
  14.  
  15. /// ===========================================================
  16.  
  17. #define CMD_HISTORY_NUM 5
  18.  
  19. char            CMD[256];
  20. char            CMD_HISTORY[CMD_HISTORY_NUM][256];
  21. char            CMD_NUM;
  22.  
  23. unsigned        CMD_POS;
  24.  
  25. /// ===========================================================
  26.  
  27. char script_sign[] = {"#SHS"};
  28.  
  29. /// ===========================================================
  30.  
  31. int NUM_OF_CMD;
  32.  
  33. /// ===========================================================
  34.  
  35. typedef struct
  36. {
  37.         const char* name;
  38.         const char* help;
  39.         const void* handler;
  40. } command_t;
  41.  
  42. /// ===========================================================
  43.  
  44. int cmd_about(char arg[]);
  45. int cmd_alias(char arg[]);
  46. int cmd_ccpuid(char dir[]);
  47. int cmd_cd(char dir[]);
  48. int cmd_clear(char arg[]);
  49. int cmd_date(char arg[]);
  50. int cmd_echo(char text[]);
  51. int cmd_exit(char arg[]);
  52. int cmd_free(char arg[]);
  53. int cmd_help(char cmd[]);
  54. int cmd_kill(char process[]);
  55. int cmd_ls(char dir[]);
  56. int cmd_mkdir(char dir[]);
  57. int cmd_more(char file[]);
  58. int cmd_ps(char arg[]);
  59. int cmd_pwd(char arg[]);
  60. int cmd_reboot(char arg[]);
  61. int cmd_rm(char file[]);
  62. int cmd_rmdir(char dir[]);
  63. int cmd_touch(char file[]);
  64. int cmd_ver(char arg[]);
  65. int cmd_sleep(char arg[]);
  66.  
  67. /// ===========================================================
  68.  
  69. const command_t COMMANDS[]=
  70. {
  71.         {"about", "  Displays information about the program\n\r", &cmd_about},
  72.         {"alias", "  Allows the user view the current aliases\n\r", &cmd_alias},
  73.         {"ccpuid","  Displays CPU information\n\r", &cmd_ccpuid},
  74.         {"cd",    "  Changes directories\n\r", &cmd_cd},
  75.         {"clear", "  Clears the display\n\r", &cmd_clear},
  76.         {"date",  "  Returns the date and time\n\r", &cmd_date},
  77.         {"echo",  "  Echoes the data to the screen\n\r", &cmd_echo},
  78.         {"exit",  "  Exits program\n\r", &cmd_exit},
  79.         {"free",  "  Displays total, free and used memory\n\r", &cmd_free},
  80.         {"help",  "  Gives help\n\r", &cmd_help},
  81.         {"kill",  "  Stops a running process\n\r", &cmd_kill},
  82.         {"ls",    "  Lists the files in a directory\n\r", &cmd_ls},
  83.         {"mkdir", "  Makes directory\n\r", &cmd_mkdir},
  84.         {"more",  "  Displays a data file to the screen\n\r", &cmd_more},
  85.         {"ps",    "  Lists the current processes running\n\r", &cmd_ps},
  86.         {"pwd",   "  Displays the name of the working directory\n\r", &cmd_pwd},
  87.         {"reboot","  Reboots the computer\n\r", &cmd_reboot},
  88.         {"rm",    "  Removes files\n\r", &cmd_rm},
  89.         {"rmdir", "  Removes directories\n\r", &cmd_rmdir},
  90.         {"sleep", "  Stops the shell for the desired period\n\r", &cmd_sleep},
  91.         {"touch", "  Creates an empty file or updates the time/date stamp on a file\n\r", &cmd_touch},
  92.         {"ver",   "  Displays version\n\r", &cmd_ver},
  93. };
  94.  
  95. /// ===========================================================
  96.  
  97.  
  98.