X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fstart.c;h=5df246225a63c1964dca5e31d79a64fbe24bff81;hb=266d3dd051c2c5e2a23009afbdc88b72c0fded5b;hp=90794c66990bfc5fed93e3a0949385b8d8c95217;hpb=4ba92f185fb1d0b112cbc804a261939f5f81dc34;p=lttng-tools.git diff --git a/src/bin/lttng/commands/start.c b/src/bin/lttng/commands/start.c index 90794c669..5df246225 100644 --- a/src/bin/lttng/commands/start.c +++ b/src/bin/lttng/commands/start.c @@ -45,22 +45,6 @@ static struct poptOption long_options[] = { {0, 0, 0, 0, 0, 0, 0} }; -/* - * usage - */ -static void usage(FILE *ofp) -{ - fprintf(ofp, "usage: lttng start [NAME] [OPTIONS]\n"); - fprintf(ofp, "\n"); - fprintf(ofp, "Where NAME is an optional session name. If not specified, lttng will\n"); - fprintf(ofp, "get it from the configuration directory (.lttng).\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"); -} - static int mi_print_session(char *session_name, int enabled) { int ret; @@ -154,6 +138,7 @@ int cmd_start(int argc, const char **argv) { int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1; static poptContext pc; + const char *leftover = NULL; pc = poptGetContext(NULL, argc, argv, long_options, 0); poptReadDefaultConfig(pc, 0); @@ -167,7 +152,6 @@ int cmd_start(int argc, const char **argv) list_cmd_options(stdout, long_options); goto end; default: - usage(stderr); ret = CMD_UNDEFINED; goto end; } @@ -175,6 +159,13 @@ int cmd_start(int argc, const char **argv) opt_session_name = (char*) poptGetArg(pc); + leftover = poptGetArg(pc); + if (leftover) { + ERR("Unknown argument: %s", leftover); + ret = CMD_ERROR; + goto end; + } + /* Mi check */ if (lttng_opt_mi) { writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi);