aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/unix/cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/unix/cli.c')
-rw-r--r--src/vlib/unix/cli.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 7b9a2315910..c8ebb3313b8 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -3436,10 +3436,28 @@ unix_cli_exec (vlib_main_t * vm,
vec_free (expanded);
}
- while (unformat_user (&sub_input, unformat_line_input, line_input))
+ while (1)
{
- vlib_cli_input (vm, line_input, 0, 0);
- unformat_free (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);
+ }
}
unformat_free (&sub_input);