X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fset_session.c;h=d143c7dd45ff2623899047b8b5e89ef0ed45dbcc;hb=dc1c9a44fba1a368c283186e531c217206f5e816;hp=c0572e1275d46f273cb446bedd8010ab4a4463a2;hpb=890d8fe47755c3bad936389cf48ffa141cff41c9;p=lttng-tools.git diff --git a/src/bin/lttng/commands/set_session.c b/src/bin/lttng/commands/set_session.c index c0572e127..d143c7dd4 100644 --- a/src/bin/lttng/commands/set_session.c +++ b/src/bin/lttng/commands/set_session.c @@ -31,6 +31,12 @@ static char *opt_session_name; +#ifdef LTTNG_EMBED_HELP +static const char help_msg[] = +#include +; +#endif + enum { OPT_HELP = 1, OPT_LIST_OPTIONS, @@ -45,19 +51,6 @@ static struct poptOption long_options[] = { {0, 0, 0, 0, 0, 0, 0} }; -/* - * usage - */ -static void usage(FILE *ofp) -{ - fprintf(ofp, "usage: lttng set-session NAME [OPTIONS]\n"); - fprintf(ofp, "\n"); - fprintf(ofp, "Options:\n"); - fprintf(ofp, " -h, --help Show this help\n"); - fprintf(ofp, " --list-options Simple listing of options\n"); - fprintf(ofp, "\n"); -} - /* * Print the necessary mi for a session and name. */ @@ -174,13 +167,12 @@ int cmd_set_session(int argc, const char **argv) while ((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { case OPT_HELP: - usage(stdout); + SHOW_HELP(); goto end; case OPT_LIST_OPTIONS: list_cmd_options(stdout, long_options); goto end; default: - usage(stderr); ret = CMD_UNDEFINED; goto end; } @@ -189,7 +181,6 @@ int cmd_set_session(int argc, const char **argv) opt_session_name = (char *) poptGetArg(pc); if (opt_session_name == NULL) { ERR("Missing session name"); - usage(stderr); ret = CMD_ERROR; goto end; } @@ -256,7 +247,7 @@ end: ret = ret ? ret : LTTNG_ERR_MI_IO_FAIL; } - /* Overwrite ret if an error occured during set_session() */ + /* Overwrite ret if an error occurred during set_session() */ ret = command_ret ? command_ret : ret; poptFreeContext(pc);