vlib: revert exec cmd handle scripts with blank lines 37/32437/2
authorRay Kinsella <mdr@ashroe.eu>
Tue, 25 May 2021 14:55:30 +0000 (15:55 +0100)
committerBeno�t Ganne <bganne@cisco.com>
Wed, 26 May 2021 07:03:26 +0000 (07:03 +0000)
This reverts commit 269e1569e1f7798bf7d7f539daf505b2f1997a08.

Type: fix

Change-Id: I40bd71ae3b5e9dc8345fb2460aae437de8a9a5ba
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
src/vlib/unix/cli.c

index c8ebb33..7b9a231 100644 (file)
@@ -3436,28 +3436,10 @@ unix_cli_exec (vlib_main_t * vm,
       vec_free (expanded);
     }
 
-  while (1)
+  while (unformat_user (&sub_input, unformat_line_input, line_input))
     {
-      int rv = unformat_user (&sub_input, unformat_line_input, line_input);
-
-      /* No match? */
-      if (rv == 0)
-       {
-         /* Out of input, we're done... */
-         if (sub_input.index == UNFORMAT_END_OF_INPUT)
-           {
-             unformat_free (line_input);
-             break;
-           }
-         /* Blank line... */
-         sub_input.index++;
-       }
-      else
-       {
-         /* Process the line we just read */
-         vlib_cli_input (vm, line_input, 0, 0);
-         unformat_free (line_input);
-       }
+      vlib_cli_input (vm, line_input, 0, 0);
+      unformat_free (line_input);
     }
   unformat_free (&sub_input);