X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Flttng.c;h=17ab16dc660a94cb27784af3fa6436bffa4765a7;hb=a1e4ab8b82429320c5f962038c0f28b874f8ea6f;hp=d905af9a683a6ad57c14acbd0f41687aefa30bb0;hpb=259c267446a63c501298f39a5d2397314b11f729;p=lttng-tools.git diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c index d905af9a6..17ab16dc6 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -32,6 +32,7 @@ #include #include "command.h" +#include "version.h" static const char *help_msg = #ifdef LTTNG_EMBED_HELP @@ -103,9 +104,10 @@ static struct cmd_struct commands[] = { static void version(FILE *ofp) { - fprintf(ofp, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME "%s\n", + fprintf(ofp, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME "%s%s\n", progname, - GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION); + GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION, + EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME); } /* @@ -252,6 +254,23 @@ end: return ret; } +static bool command_exists(const char *command) +{ + const struct cmd_struct *cmd = commands; + bool exists = false; + + while (cmd->name != NULL) { + if (!strcmp(command, cmd->name)) { + exists = true; + goto end; + } + cmd++; + } + +end: + return exists; +} + static void show_basic_help(void) { puts("Usage: lttng [--group=GROUP] [--mi=TYPE] [--no-sessiond | --sessiond-path=PATH]"); @@ -285,6 +304,11 @@ static void show_basic_help(void) puts(" start " CONFIG_CMD_DESCR_START); puts(" stop " CONFIG_CMD_DESCR_STOP); puts(""); + puts("Tracing session rotation:"); + puts(" disable-rotation " CONFIG_CMD_DESCR_DISABLE_ROTATION); + puts(" enable-rotation " CONFIG_CMD_DESCR_ENABLE_ROTATION); + puts(" rotate " CONFIG_CMD_DESCR_ROTATE); + puts(""); puts("Resource tracking:"); puts(" track " CONFIG_CMD_DESCR_TRACK); puts(" untrack " CONFIG_CMD_DESCR_UNTRACK); @@ -402,19 +426,19 @@ static int parse_args(int argc, char **argv) ret = handle_command(argc - optind, argv + optind); switch (ret) { case CMD_WARNING: - WARN("Some command(s) went wrong"); - break; case CMD_ERROR: - ERR("Command error"); break; case CMD_UNDEFINED: - ERR("Undefined command or invalid arguments"); + if (!command_exists(*(argv + optind))) { + MSG("lttng: %s is not an lttng command. See 'lttng --help'.", + *(argv + optind)); + } else { + ERR("Unrecognized argument used with \'%s\' command", + *(argv + optind)); + } break; case CMD_FATAL: - ERR("Fatal error"); - break; case CMD_UNSUPPORTED: - ERR("Unsupported command"); break; case -1: ret = 1;