pg: exec file fixes
[vpp.git] / src / vlib / unix / cli.c
index 8120bef..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: