Changeset 5c141d6a in rtems


Ignore:
Timestamp:
Nov 18, 2014, 9:36:27 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
ffd5285
Parents:
1227858
git-author:
Sebastian Huber <sebastian.huber@…> (11/18/14 09:36:27)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/20/14 09:30:25)
Message:

shell: Add and use rtems_shell_execute_cmd()

Location:
cpukit/libmisc/shell
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/shell/internal.h

    r1227858 r5c141d6a  
    2626rtems_shell_topic_t * rtems_shell_lookup_topic(const char *topic);
    2727
     28int rtems_shell_execute_cmd(const char *cmd, int argc, char *argv[]);
    2829
    2930extern void rtems_shell_register_monitor_commands(void);
  • cpukit/libmisc/shell/main_time.c

    r1227858 r5c141d6a  
    3939)
    4040{
    41   rtems_shell_cmd_t* shell_cmd;
    4241  int                errorlevel = 0;
    4342  struct timespec    start;
     
    5352
    5453  if (argc) {
    55     shell_cmd = rtems_shell_lookup_cmd(argv[1]);
    56     if ( argv[1] == NULL ) {
    57       errorlevel = -1;
    58     } else if ( shell_cmd == NULL ) {
    59       errorlevel = rtems_shell_script_file(argc, &argv[1]);
    60     } else {
    61       errorlevel = shell_cmd->command(argc, &argv[1]);
    62     }
     54    errorlevel = rtems_shell_execute_cmd(argv[1], argc, &argv[1]);
    6355  }
    6456
  • cpukit/libmisc/shell/shell.c

    r1227858 r5c141d6a  
    706706{
    707707  rtems_shell_env_t *shell_env;
    708   rtems_shell_cmd_t *shell_cmd;
    709708  int                eno;
    710709  struct termios     term;
     
    918917          if (!rtems_shell_make_args(cmd_argv, &argc, argv,
    919918                                     RTEMS_SHELL_MAXIMUM_ARGUMENTS)) {
    920             shell_cmd = rtems_shell_lookup_cmd(argv[0]);
    921             if ( argv[0] == NULL ) {
    922               shell_env->errorlevel = -1;
    923             } else if ( shell_cmd == NULL ) {
    924               shell_env->errorlevel = rtems_shell_script_file(argc, argv);
    925             } else {
    926               shell_env->errorlevel = shell_cmd->command(argc, argv);
    927             }
     919            shell_env->errorlevel = rtems_shell_execute_cmd(argv[0], argc, argv);
    928920          }
    929921
  • cpukit/libmisc/shell/shell_cmdset.c

    r1227858 r5c141d6a  
    215215  return shell_aux;
    216216}
     217
     218int rtems_shell_execute_cmd(const char *cmd, int argc, char *argv[])
     219{
     220  rtems_shell_cmd_t *shell_cmd;
     221
     222  if (argv[0] == NULL) {
     223    return -1;
     224  }
     225
     226  shell_cmd = rtems_shell_lookup_cmd(argv[0]);
     227
     228  if (shell_cmd == NULL) {
     229    return rtems_shell_script_file(argc, argv);
     230  } else {
     231    return shell_cmd->command(argc, argv);
     232  }
     233}
Note: See TracChangeset for help on using the changeset viewer.