aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp/api
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-02-22 17:29:20 -0500
committerDave Barach <dave@barachs.net>2017-02-22 17:29:58 -0500
commitdef19da0c92bfffc23ad898e459271c7c9209110 (patch)
tree7bfc395d5bb3b213722e8e7bc8823561519be3e8 /src/vpp/api
parent974cdc6faacc49ef393eeea6e4c9643f767d2792 (diff)
Clean up "binary-api" help string, arg parse bugs
Change-Id: I12311be8ebd376b8aeac25364d010d70a85c7874 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vpp/api')
-rw-r--r--src/vpp/api/api_main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vpp/api/api_main.c b/src/vpp/api/api_main.c
index 396db25b..97b501e0 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 <name> [<args>]",
+ .short_help = "binary-api [help] <name> [<args>]",
.function = api_command_fn,
};
/* *INDENT-ON* */