Rev 959 | Rev 1668 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 959 | Rev 1647 | ||
---|---|---|---|
Line 1... | Line -... | ||
1 | #define FALSE 0 |
- | |
2 | #define TRUE 1 |
- | |
3 | - | ||
4 | #define SHELL_VERSION "0.4" |
1 | #define SHELL_VERSION "0.4.4" |
Line 5... | Line 2... | ||
5 | 2 | ||
6 | extern char PATH[256]; |
3 | extern char PATH[256]; |
Line 7... | Line 4... | ||
7 | extern char PARAM[256]; |
4 | extern char PARAM[256]; |
Line 29... | Line 26... | ||
29 | char script_sign[] = {"#SHS"}; |
26 | char script_sign[] = {"#SHS"}; |
Line 30... | Line 27... | ||
30 | 27 | ||
Line 31... | Line 28... | ||
31 | /// =========================================================== |
28 | /// =========================================================== |
- | 29 | ||
- | 30 | int NUM_OF_CMD; |
|
Line 32... | Line 31... | ||
32 | 31 | ||
33 | const NUM_OF_CMD = 19; |
32 | /// =========================================================== |
34 | - | ||
35 | const char HELP_COMMANDS[][10]= |
33 | |
36 | { |
- | |
37 | "about", |
- | |
38 | "alias", |
- | |
39 | "cd", |
- | |
40 | "date", |
- | |
41 | "echo", |
- | |
42 | "exit", |
- | |
43 | "free", |
- | |
44 | "help", |
- | |
45 | "kill", |
34 | typedef struct |
46 | "ls", |
- | |
47 | "mkdir", |
- | |
48 | "more", |
35 | { |
49 | "ps", |
- | |
50 | "pwd", |
- | |
51 | "reboot", |
36 | const char* name; |
52 | "rm", |
- | |
53 | "rmdir", |
37 | const char* help; |
- | 38 | const void* handler; |
|
Line -... | Line 39... | ||
- | 39 | } command_t; |
|
- | 40 | ||
- | 41 | /// =========================================================== |
|
- | 42 | ||
- | 43 | int cmd_about(char arg[]); |
|
- | 44 | int cmd_alias(char arg[]); |
|
- | 45 | int cmd_ccpuid(char dir[]); |
|
- | 46 | int cmd_cd(char dir[]); |
|
- | 47 | int cmd_clear(char arg[]); |
|
- | 48 | int cmd_date(char arg[]); |
|
- | 49 | int cmd_echo(char text[]); |
|
- | 50 | int cmd_exit(char arg[]); |
|
- | 51 | int cmd_free(char arg[]); |
|
- | 52 | int cmd_help(char cmd[]); |
|
- | 53 | int cmd_kill(char process[]); |
|
- | 54 | int cmd_ls(char dir[]); |
|
- | 55 | int cmd_mkdir(char dir[]); |
|
- | 56 | int cmd_more(char file[]); |
|
- | 57 | int cmd_ps(char arg[]); |
|
- | 58 | int cmd_pwd(char arg[]); |
|
- | 59 | int cmd_reboot(char arg[]); |
|
- | 60 | int cmd_rm(char file[]); |
|
- | 61 | int cmd_rmdir(char dir[]); |
|
- | 62 | int cmd_touch(char file[]); |
|
- | 63 | int cmd_ver(char arg[]); |
|
54 | "touch", |
64 | int cmd_sleep(char arg[]); |
55 | "ver" |
65 | |
56 | }; |
66 | /// =========================================================== |
57 | 67 | ||
- | 68 | const command_t COMMANDS[]= |
|
58 | const char HELP_DESC [][70]= |
69 | { |
- | 70 | {"about", " Displays information about the program\n\r", &cmd_about}, |
|
59 | { |
71 | {"alias", " Allows the user view the current aliases\n\r", &cmd_alias}, |
60 | " Displays information about the program\n\r", |
72 | {"ccpuid"," Displays CPU information\n\r", &cmd_ccpuid}, |
61 | " Allows the user view the current aliases\n\r", |
73 | {"cd", " Changes directories\n\r", &cmd_cd}, |
62 | " Changes directories\n\r", |
74 | {"clear", " Clears the display\n\r", &cmd_clear}, |
63 | " Returns the date and time\n\r", |
75 | {"date", " Returns the date and time\n\r", &cmd_date}, |
64 | " Echoes the data to the screen\n\r", |
76 | {"echo", " Echoes the data to the screen\n\r", &cmd_echo}, |
65 | " Exits program\n\r", |
77 | {"exit", " Exits program\n\r", &cmd_exit}, |
66 | " Displays total, free and used memory\n\r", |
78 | {"free", " Displays total, free and used memory\n\r", &cmd_free}, |
67 | " Gives help\n\r", |
79 | {"help", " Gives help\n\r", &cmd_help}, |
68 | " Stops a running process\n\r", |
80 | {"kill", " Stops a running process\n\r", &cmd_kill}, |
69 | " Lists the files in a directory\n\r", |
81 | {"ls", " Lists the files in a directory\n\r", &cmd_ls}, |
70 | " Makes directory\n\r", |
82 | {"mkdir", " Makes directory\n\r", &cmd_mkdir}, |
71 | " Displays a data file to the screen\n\r", |
83 | {"more", " Displays a data file to the screen\n\r", &cmd_more}, |
72 | " Lists the current processes running\n\r", |
84 | {"ps", " Lists the current processes running\n\r", &cmd_ps}, |
- | 85 | {"pwd", " Displays the name of the working directory\n\r", &cmd_pwd}, |
|
73 | " Displays the name of the working directory\n\r", |
86 | {"reboot"," Reboots the computer\n\r", &cmd_reboot}, |
74 | " Reboots the computer\n\r", |
87 | {"rm", " Removes files\n\r", &cmd_rm}, |
75 | " Removes files\n\r", |
88 | {"rmdir", " Removes directories\n\r", &cmd_rmdir}, |
Line 76... | Line 89... | ||
76 | " Removes directories\n\r", |
89 | {"sleep", " Stops the shell for the desired period\n\r", &cmd_sleep}, |
- | 90 | {"touch", " Creates an empty file or updates the time/date stamp on a file\n\r", &cmd_touch}, |
|
- | 91 | {"ver", " Displays version\n\r", &cmd_ver}, |