vat2: fix -p in vat2 help text 77/41277/3
authorBence Romsics <[email protected]>
Thu, 18 Jul 2024 08:57:12 +0000 (10:57 +0200)
committerDave Wallace <[email protected]>
Wed, 2 Apr 2025 18:06:05 +0000 (18:06 +0000)
Since commit fe1fb3c31a short option -p stands for --plugin-path and -s
stands for --prefix. Adjust the help text. Also fix a typo and sort
option lists.

Type: fix
Change-Id: I8e9fd825cca930e13e0a09a4492f22951a25e2ee
Signed-off-by: Bence Romsics <[email protected]>
src/vat2/main.c

index bf41585..2949c48 100644 (file)
@@ -253,16 +253,15 @@ print_help (void)
     "Send API message to VPP and print reply\n"
     "\n"
     "-d, --debug                    Print additional information\n"
-    "-p, --prefix <prefix>          Specify shared memory prefix to connect "
-    "to a given VPP instance\n"
+    "--dump-apis                    List all APIs available in VAT2 (might "
+    "not reflect running VPP)\n"
     "-f, --file <filename>          File containing a JSON object with the "
     "arguments for the message to send\n"
+    "-p, --plugin-path              Plugin path\n"
+    "-s, --prefix <prefix>          Specify shared memory prefix to connect "
+    "to a given VPP instance\n"
     "-t, --template <message-name>  Print a template JSON object for given API"
-    " message\n"
-    "--dump-apis                    List all APIs available in VAT2 (might "
-    "not reflect running VPP)\n"
-    "--plugin-path                  Pluing path"
-    "\n";
+    " message\n";
   printf ("%s", help_string);
 }
 
@@ -281,38 +280,38 @@ main (int argc, char **argv)
   char *msgname = 0;
   static struct option long_options[] = {
     { "debug", no_argument, 0, 'd' },
-    { "prefix", required_argument, 0, 's' },
-    { "file", required_argument, 0, 'f' },
     { "dump-apis", no_argument, 0, 0 },
-    { "template", required_argument, 0, 't' },
+    { "file", required_argument, 0, 'f' },
     { "plugin-path", required_argument, 0, 'p' },
+    { "prefix", required_argument, 0, 's' },
+    { "template", required_argument, 0, 't' },
     { 0, 0, 0, 0 }
   };
 
-  while ((c = getopt_long (argc, argv, "hdp:f:t:", long_options,
+  while ((c = getopt_long (argc, argv, "df:p:s:t:", long_options,
                           &option_index)) != -1)
     {
       switch (c)
        {
        case 0:
-         if (option_index == 3)
+         if (option_index == 1)
            dump_api = true;
          break;
        case 'd':
          vat2_debug = true;
          break;
-       case 't':
-         template = optarg;
-         break;
-       case 's':
-         prefix = optarg;
-         break;
        case 'f':
          filename = optarg;
          break;
        case 'p':
          pluginpath = optarg;
          break;
+       case 's':
+         prefix = optarg;
+         break;
+       case 't':
+         template = optarg;
+         break;
        case '?':
          print_help ();
          return 1;