Changeset 2465c01 in rtems


Ignore:
Timestamp:
Aug 14, 2017, 4:50:55 AM (2 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
b2353ed9
Parents:
0daa8ab
Message:

libmisc/shell: Make some internal shell functions public.

  • Add 'rtems_shell_init_environment()' so a user can create the shell environment without needing to run a shell.
  • Move 'rtems_shell_lookup_topic', 'rtems_shell_can_see_cmd', and 'rtems_shell_execute_cmd' from the internal interface to the public interface.

Closes #3096.

Location:
cpukit/libmisc/shell
Files:
3 edited

Legend:

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

    r0daa8ab r2465c01  
    1212#include "shell.h"
    1313
    14 struct rtems_shell_topic_tt;
    15 typedef struct rtems_shell_topic_tt rtems_shell_topic_t;
    16 
    17 struct rtems_shell_topic_tt {
    18   const char          *topic;
    19   rtems_shell_topic_t *next;
    20 };
    21 
    22 
    2314extern rtems_shell_cmd_t   * rtems_shell_first_cmd;
    2415extern rtems_shell_topic_t * rtems_shell_first_topic;
    25 
    26 rtems_shell_topic_t * rtems_shell_lookup_topic(const char *topic);
    27 
    28 bool rtems_shell_can_see_cmd(const rtems_shell_cmd_t *shell_cmd);
    29 
    30 int rtems_shell_execute_cmd(const char *cmd, int argc, char *argv[]);
    3116
    3217extern void rtems_shell_register_monitor_commands(void);
  • cpukit/libmisc/shell/shell.c

    r0daa8ab r2465c01  
    148148
    149149  rtems_shell_init_commands();
     150  rtems_shell_register_monitor_commands();
     151}
     152
     153void rtems_shell_init_environment(void)
     154{
     155  assert(pthread_once(&rtems_shell_once, rtems_shell_init_once) == 0);
    150156}
    151157
     
    722728  FILE              *stdoutToClose = NULL;
    723729
    724   eno = pthread_once(&rtems_shell_once, rtems_shell_init_once);
    725   assert(eno == 0);
    726 
    727   rtems_shell_register_monitor_commands();
     730  rtems_shell_init_environment();
    728731
    729732  shell_env = rtems_shell_init_env(shell_env_arg);
  • cpukit/libmisc/shell/shell.h

    r0daa8ab r2465c01  
    9595} rtems_shell_alias_t;
    9696
     97struct rtems_shell_topic_tt;
     98typedef struct rtems_shell_topic_tt rtems_shell_topic_t;
     99
     100struct rtems_shell_topic_tt {
     101  const char          *topic;
     102  rtems_shell_topic_t *next;
     103};
     104
    97105/*
    98106 * The return value has RTEMS_SHELL_KEYS_EXTENDED set if the key
     
    124132  char **argv_p,
    125133  int    max_args
     134);
     135
     136extern rtems_shell_topic_t * rtems_shell_lookup_topic(
     137  const char *topic
     138);
     139
     140extern bool rtems_shell_can_see_cmd(
     141  const rtems_shell_cmd_t *shell_cmd
     142);
     143
     144extern int rtems_shell_execute_cmd(
     145  const char *cmd, int argc, char *argv[]
     146);
     147
     148/*
     149 * Call to set up the shell environment if you need to execute commands before
     150 * running a shell.
     151 */
     152extern void rtems_shell_init_environment(
     153  void
    126154);
    127155
Note: See TracChangeset for help on using the changeset viewer.