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}
};
fprintf(ofp, "get it from the configuration directory (.lttng).\n");
fprintf(ofp, "\n");
fprintf(ofp, " -h, --help Show this help\n");
+ fprintf(ofp, " --list-options Simple listing of options\n");
fprintf(ofp, "\n");
}
ret = lttng_destroy_session(session_name);
if (ret < 0) {
+ /* Don't set ret so lttng can interpret the sessiond error. */
goto free_name;
}
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
case OPT_HELP:
- usage(stderr);
+ usage(stdout);
+ goto end;
+ case OPT_LIST_OPTIONS:
+ list_cmd_options(stdout, long_options);
goto end;
default:
usage(stderr);
ret = destroy_session();
end:
+ poptFreeContext(pc);
return ret;
}