[ovs-dev] [PATCH 3/4] ovs-appctl: Add option '--option' to show all long options.
Alex Wang
alexw at nicira.com
Wed Sep 10 19:52:26 UTC 2014
Signed-off-by: Alex Wang <alexw at nicira.com>
---
utilities/ovs-appctl.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c
index bb17ec2..8249bf8 100644
--- a/utilities/ovs-appctl.c
+++ b/utilities/ovs-appctl.c
@@ -81,6 +81,19 @@ main(int argc, char *argv[])
}
static void
+options(const struct option *opts, size_t len)
+{
+ int i;
+
+ for (i = 0; i < len - 1; i++) {
+ const struct option *opt = &opts[i];
+
+ printf("--%s\n", opt->name);
+ }
+ exit(EXIT_SUCCESS);
+}
+
+static void
usage(void)
{
printf("\
@@ -116,6 +129,7 @@ parse_command_line(int argc, char *argv[])
{"target", required_argument, NULL, 't'},
{"execute", no_argument, NULL, 'e'},
{"help", no_argument, NULL, 'h'},
+ {"option", no_argument, NULL, 'o'},
{"version", no_argument, NULL, 'V'},
{"timeout", required_argument, NULL, 'T'},
VLOG_LONG_OPTIONS,
@@ -157,6 +171,11 @@ parse_command_line(int argc, char *argv[])
usage();
break;
+ case 'o':
+ /* Always skips the last one. */
+ options(long_options, ARRAY_SIZE(long_options) - 1);
+ break;
+
case 'T':
time_alarm(atoi(optarg));
break;
--
1.7.9.5
More information about the dev
mailing list