pg: exec file fixes
[vpp.git] / src / vlib / unix / cli.c
index 9d26e6e..7b9a231 100644 (file)
@@ -449,13 +449,6 @@ static unix_cli_parse_actions_t unix_cli_parse_pager[] = {
 
 #undef _
 
-/** CLI session events. */
-typedef enum
-{
-  UNIX_CLI_PROCESS_EVENT_READ_READY,  /**< A file descriptor has data to be read. */
-  UNIX_CLI_PROCESS_EVENT_QUIT,       /**< A CLI session wants to close. */
-} unix_cli_process_event_type_t;
-
 /** CLI session telnet negotiation timer events. */
 typedef enum
 {
@@ -2893,9 +2886,9 @@ unix_cli_file_add (unix_cli_main_t * cm, char *name, int fd)
        * the same new name.
        * Then, throw away the old shared name-vector.
        */
-      for (i = 0; i < vec_len (vlib_mains); i++)
+      for (i = 0; i < vlib_get_n_threads (); i++)
        {
-         this_vlib_main = vlib_mains[i];
+         this_vlib_main = vlib_get_main_by_index (i);
          if (this_vlib_main == 0)
            continue;
          n = vlib_get_node (this_vlib_main,
@@ -3359,6 +3352,7 @@ unix_cli_exec (vlib_main_t * vm,
   char *file_name;
   int fd;
   unformat_input_t sub_input;
+  unformat_input_t _line_input, *line_input = &_line_input;
   clib_error_t *error;
   unix_cli_main_t *cm = &unix_cli_main;
   unix_cli_file_t *cf;
@@ -3442,7 +3436,11 @@ unix_cli_exec (vlib_main_t * vm,
       vec_free (expanded);
     }
 
-  vlib_cli_input (vm, &sub_input, 0, 0);
+  while (unformat_user (&sub_input, unformat_line_input, line_input))
+    {
+      vlib_cli_input (vm, line_input, 0, 0);
+      unformat_free (line_input);
+    }
   unformat_free (&sub_input);
 
 done:
@@ -3575,7 +3573,7 @@ unix_show_files (vlib_main_t * vm,
                   "Read", "Write", "Error", "File Name", "Description");
 
   /* *INDENT-OFF* */
-  pool_foreach (f, fm->file_pool,(
+  pool_foreach (f, fm->file_pool)
    {
       int rv;
       s = format (s, "/proc/self/fd/%d%c", f->file_descriptor, 0);
@@ -3588,7 +3586,7 @@ unix_show_files (vlib_main_t * vm,
                       f->read_events, f->write_events, f->error_events,
                       path, f->description);
       vec_reset_length (s);
-    }));
+    }
   /* *INDENT-ON* */
   vec_free (s);
 
@@ -3728,7 +3726,7 @@ unix_cli_show_cli_sessions (vlib_main_t * vm,
 
 #define fl(x, y) ( (x) ? toupper((y)) : tolower((y)) )
   /* *INDENT-OFF* */
-  pool_foreach (cf, cm->cli_file_pool, ({
+  pool_foreach (cf, cm->cli_file_pool)  {
     uf = pool_elt_at_index (fm->file_pool, cf->clib_file_index);
     n = vlib_get_node (vm, cf->process_node_index);
     vlib_cli_output (vm,
@@ -3741,7 +3739,7 @@ unix_cli_show_cli_sessions (vlib_main_t * vm,
                     fl (cf->line_mode, 'l'),
                     fl (cf->has_epipe, 'p'),
                     fl (cf->ansi_capable, 'a'));
-  }));
+  }
   /* *INDENT-ON* */
 #undef fl