From: Dave Barach Date: Wed, 22 Feb 2017 22:29:20 +0000 (-0500) Subject: Clean up "binary-api" help string, arg parse bugs X-Git-Tag: v17.04-rc1~177 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=def19da0c92bfffc23ad898e459271c7c9209110;p=vpp.git Clean up "binary-api" help string, arg parse bugs Change-Id: I12311be8ebd376b8aeac25364d010d70a85c7874 Signed-off-by: Dave Barach --- diff --git a/src/vat/api_format.c b/src/vat/api_format.c index b0df35facd4..039fca06891 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -17790,7 +17790,9 @@ api_sw_interface_set_mtu (vat_main_t * vam) static int q_or_quit (vat_main_t * vam) { +#if VPP_API_TEST_BUILTIN == 0 longjmp (vam->jump_buf, 1); +#endif return 0; /* not so much */ } diff --git a/src/vpp/api/api_main.c b/src/vpp/api/api_main.c index 396db25b5cf..97b501e09fa 100644 --- a/src/vpp/api/api_main.c +++ b/src/vpp/api/api_main.c @@ -88,6 +88,7 @@ api_command_fn (vlib_main_t * vm, /* Split input into cmd + args */ this_cmd = cmdp = vam->inbuf; + /* Skip leading whitespace */ while (cmdp < (this_cmd + vec_len (this_cmd))) { if (*cmdp == ' ' || *cmdp == '\t' || *cmdp == '\n') @@ -99,15 +100,18 @@ api_command_fn (vlib_main_t * vm, } argsp = cmdp; + + /* Advance past the command */ while (argsp < (this_cmd + vec_len (this_cmd))) { - if (*argsp != ' ' && *argsp != '\t' && *argsp != '\n') + if (*argsp != ' ' && *argsp != '\t' && *argsp != '\n' && argsp != 0) { argsp++; } else break; } + /* NULL terminate the command */ *argsp++ = 0; while (argsp < (this_cmd + vec_len (this_cmd))) @@ -158,7 +162,7 @@ api_command_fn (vlib_main_t * vm, VLIB_CLI_COMMAND (api_command, static) = { .path = "binary-api", - .short_help = "binary-api []", + .short_help = "binary-api [help] []", .function = api_command_fn, }; /* *INDENT-ON* */