summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/main_help.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-11-18 07:35:30 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-11-20 10:30:26 +0100
commit7eada71e1b8e707d5b97d4d0cf7d2ca73013e403 (patch)
tree0595921de0173366d2bfb5331be1fb89ab1001ca /cpukit/libmisc/shell/main_help.c
parentshell: Inherit UID and GID if no login check (diff)
downloadrtems-7eada71e1b8e707d5b97d4d0cf7d2ca73013e403.tar.bz2
shell: Add mode, UID and GID to shell commands
Use this information to determine if a command is visible to the current user and if the current user is allowed to execute this command.
Diffstat (limited to 'cpukit/libmisc/shell/main_help.c')
-rw-r--r--cpukit/libmisc/shell/main_help.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/cpukit/libmisc/shell/main_help.c b/cpukit/libmisc/shell/main_help.c
index 19339594dc..393d7e8172 100644
--- a/cpukit/libmisc/shell/main_help.c
+++ b/cpukit/libmisc/shell/main_help.c
@@ -27,12 +27,16 @@
* show the help for one command.
*/
static int rtems_shell_help_cmd(
- rtems_shell_cmd_t *shell_cmd
+ const rtems_shell_cmd_t *shell_cmd
)
{
const char * pc;
int col,line;
+ if (!rtems_shell_can_see_cmd(shell_cmd)) {
+ return 0;
+ }
+
printf("%-12.12s - ",shell_cmd->name);
col = 14;
line = 1;
@@ -149,10 +153,9 @@ static int rtems_shell_help(
}
rtems_shell_cmd_t rtems_shell_HELP_Command = {
- "help", /* name */
- "help [topic] # list of usage of commands", /* usage */
- "help", /* topic */
- rtems_shell_help, /* command */
- NULL, /* alias */
- NULL /* next */
+ .name = "help",
+ .usage = "help [topic] # list of usage of commands",
+ .topic = "help",
+ .command = rtems_shell_help,
+ .mode = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH
};