source: rtems/cpukit/libmisc/shell/main_alias.c @ 7eada71

4.115
Last change on this file since 7eada71 was 7eada71, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 18, 2014 at 6:35:30 AM

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.

  • Property mode set to 100644
File size: 956 bytes
Line 
1/*
2 *  ALIAS Shell Command Implmentation
3 *
4 *  Author: Fernando RUIZ CASAS
5 *  Work: fernando.ruiz@ctv.es
6 *  Home: correo@fernando-ruiz.com
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.org/license/LICENSE.
11 */
12
13#ifdef HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <stdio.h>
18
19#include <rtems.h>
20#include <rtems/shell.h>
21#include "internal.h"
22
23static int rtems_shell_rtems_main_alias(int argc, char **argv)
24{
25  if (argc<3) {
26    fprintf(stderr,"too few arguments\n");
27    return 1;
28  }
29
30  if (!rtems_shell_alias_cmd(argv[1],argv[2])) {
31    fprintf(stderr,"unable to make an alias(%s,%s)\n",argv[1],argv[2]);
32  }
33  return 0;
34}
35
36rtems_shell_cmd_t rtems_shell_ALIAS_Command = {
37  .name = "alias",
38  .usage = "alias old new",
39  .topic = "misc",
40  .command = rtems_shell_rtems_main_alias,
41  .mode = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH
42};
Note: See TracBrowser for help on using the repository browser.