Clean up binary api message handler registration issues
[vpp.git] / src / vpp / api / api_main.c
index 396db25..6ae510b 100644 (file)
@@ -48,7 +48,6 @@ api_main_init (vlib_main_t * vm)
   vam->vlib_main = vm;
   vam->my_client_index = (u32) ~ 0;
   init_error_string_table (vam);
-  vat_api_hookup (vam);
   rv = vat_plugin_init (vam);
   if (rv)
     clib_warning ("vat_plugin_init returned %d", rv);
@@ -88,6 +87,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 +99,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 +161,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* */