Uploaded image for project: 'vpp'
  1. vpp
  2. VPP-906

unformat failed to parse inputs of u32 and u16

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Medium Medium
    • None
    • None
    • VPPInfra
    • None

      unformat failed to parse parameters of u32 followed by u16. u32 always get 0. here is the sample code and test result.

      static clib_error_t *
      f(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
      {
      u32 x=1;
      u16 y=2;

      unformat(input, "%d %d", &x, &y);

      printf("\nx=%d y=%d\n", x, y);

      return 0;
      }
      /* INDENT-OFF */
      VLIB_CLI_COMMAND (f_cmd, static) = {
      .path = "f",
      .short_help = "f <x> <y>",
      .function = f,
      };
      /* INDENT-ON */

       

      vpp# f 3 4

      x=0 y=4
      vpp#

       

            chjin Chaoyu Jin
            chjin Chaoyu Jin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: