X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fversion.c;h=030ccaae2937d89f071563f78ee4f6dfc78f306d;hb=e7248846cfa228ceeb454fa6b0b69bf283cef937;hp=c9b547bce2a2a844e6cd22e58e0a962a9ae8f7b0;hpb=c399183f4b3257c43915f3d81f44befd23165ad9;p=lttng-tools.git diff --git a/src/bin/lttng/commands/version.c b/src/bin/lttng/commands/version.c index c9b547bce..030ccaae2 100644 --- a/src/bin/lttng/commands/version.c +++ b/src/bin/lttng/commands/version.c @@ -30,11 +30,13 @@ enum { OPT_HELP = 1, + OPT_LIST_OPTIONS, }; static struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0}, + {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL}, {0, 0, 0, 0, 0, 0, 0} }; @@ -46,6 +48,7 @@ static void usage(FILE *ofp) fprintf(ofp, "usage: lttng version\n"); fprintf(ofp, "\n"); fprintf(ofp, " -h, --help Show this help\n"); + fprintf(ofp, " --list-options Simple listing of options\n"); fprintf(ofp, "\n"); } @@ -63,8 +66,10 @@ int cmd_version(int argc, const char **argv) while ((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { case OPT_HELP: - usage(stderr); - ret = CMD_SUCCESS; + usage(stdout); + goto end; + case OPT_LIST_OPTIONS: + list_cmd_options(stdout, long_options); goto end; default: usage(stderr); @@ -78,5 +83,6 @@ int cmd_version(int argc, const char **argv) MSG("\nlttng is free software and under the GPL license."); end: + poptFreeContext(pc); return ret; }