Changeset 7840b66 in rtems


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

shell: Add initial commands and aliases only once

Make tables read-only.

Location:
cpukit/libmisc/shell
Files:
4 edited

Legend:

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

    r7a2c30f r7840b66  
    2828
    2929extern void rtems_shell_register_monitor_commands(void);
    30 extern void rtems_shell_initialize_command_set(void);
    3130
    3231extern void rtems_shell_print_heap_info(
  • cpukit/libmisc/shell/shell.c

    r7a2c30f r7840b66  
    113113}
    114114
     115static void rtems_shell_init_commands(void)
     116{
     117  rtems_shell_cmd_t * const *c;
     118  rtems_shell_alias_t * const *a;
     119
     120  for ( c = rtems_shell_Initial_commands ; *c  ; c++ ) {
     121    rtems_shell_add_cmd_struct( *c );
     122  }
     123
     124  for ( a = rtems_shell_Initial_aliases ; *a  ; a++ ) {
     125    rtems_shell_alias_cmd( (*a)->name, (*a)->alias );
     126  }
     127}
     128
    115129static void rtems_shell_init_once(void)
    116130{
     
    132146                          "Welcome to %v\n"
    133147                          "running on %m\n");
     148
     149  rtems_shell_init_commands();
    134150}
    135151
     
    707723  FILE              *stdoutToClose = NULL;
    708724
    709   rtems_shell_initialize_command_set();
    710 
    711725  eno = pthread_once(&rtems_shell_once, rtems_shell_init_once);
    712726  assert(eno == 0);
     727
     728  rtems_shell_register_monitor_commands();
    713729
    714730  shell_env = rtems_shell_init_env(shell_env_arg);
     
    791807  setvbuf(stdout,NULL,_IONBF,0); /* Not buffered*/
    792808
    793   rtems_shell_initialize_command_set();
    794 
    795809  /*
    796810   * Allocate the command line buffers.
  • cpukit/libmisc/shell/shell_cmdset.c

    r7a2c30f r7840b66  
    182182
    183183  return shell_cmd;
    184 }
    185 
    186 
    187 void rtems_shell_initialize_command_set(void)
    188 {
    189   rtems_shell_cmd_t **c;
    190   rtems_shell_alias_t **a;
    191 
    192   for ( c = rtems_shell_Initial_commands ; *c  ; c++ ) {
    193     rtems_shell_add_cmd_struct( *c );
    194   }
    195 
    196   for ( a = rtems_shell_Initial_aliases ; *a  ; a++ ) {
    197     rtems_shell_alias_cmd( (*a)->name, (*a)->alias );
    198   }
    199 
    200   rtems_shell_register_monitor_commands();
    201184}
    202185
  • cpukit/libmisc/shell/shellconfig.h

    r7a2c30f r7840b66  
    9191#endif
    9292
    93 extern rtems_shell_cmd_t *rtems_shell_Initial_commands[];
     93extern rtems_shell_cmd_t * const rtems_shell_Initial_commands[];
    9494
    9595/*
     
    100100extern rtems_shell_alias_t rtems_shell_EXIT_Alias;
    101101
    102 extern rtems_shell_alias_t *rtems_shell_Initial_aliases[];
     102extern rtems_shell_alias_t * const rtems_shell_Initial_aliases[];
    103103
    104104/*
     
    125125
    126126#if defined(CONFIGURE_SHELL_COMMANDS_INIT)
    127   rtems_shell_alias_t *rtems_shell_Initial_aliases[] = {
     127  rtems_shell_alias_t * const rtems_shell_Initial_aliases[] = {
    128128    #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \
    129129         !defined(CONFIGURE_SHELL_NO_COMMAND_DIR)) || \
     
    151151  };
    152152
    153   rtems_shell_cmd_t *rtems_shell_Initial_commands[] = {
     153  rtems_shell_cmd_t * const rtems_shell_Initial_commands[] = {
    154154    /*
    155155     *  General comamnds that should be present
Note: See TracChangeset for help on using the changeset viewer.