X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fversion.c;h=b1ab7fd75e3b2d316e4f8cdae472db6f189bc826;hb=2987f3288fbdc2d42e79a159ce4a9b8153f86f2d;hp=d27013689635aac7536b74db8c5cd753620e816b;hpb=c7e35b037773dbbfe10178c946ba44feefb226e1;p=deliverable%2Flttng-tools.git diff --git a/src/bin/lttng/commands/version.c b/src/bin/lttng/commands/version.c index d27013689..b1ab7fd75 100644 --- a/src/bin/lttng/commands/version.c +++ b/src/bin/lttng/commands/version.c @@ -15,7 +15,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -23,7 +23,6 @@ #include #include #include -#include #include @@ -43,19 +42,6 @@ static struct poptOption long_options[] = { {0, 0, 0, 0, 0, 0, 0} }; -/* - * usage - */ -static void usage(FILE *ofp) -{ - fprintf(ofp, "usage: lttng version [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"); -} - /* * create_version */ @@ -65,6 +51,7 @@ static void create_version(struct mi_lttng_version *version) version->version_major = VERSION_MAJOR; version->version_minor = VERSION_MINOR; version->version_patchlevel = VERSION_PATCHLEVEL; + strncpy(version->version_commit, GIT_VERSION, NAME_MAX); strncpy(version->version_name, VERSION_NAME, NAME_MAX); strncpy(version->package_url, PACKAGE_URL, NAME_MAX); } @@ -148,13 +135,12 @@ int cmd_version(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; } @@ -163,10 +149,20 @@ int cmd_version(int argc, const char **argv) if (lttng_opt_mi) { ret = print_mi(); } else { - MSG("lttng version " FULL_VERSION " - " VERSION_NAME); + MSG("lttng version " VERSION " - " VERSION_NAME "%s", + GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION); MSG("\n" VERSION_DESCRIPTION "\n"); MSG("Web site: http://lttng.org"); MSG("\n%s", lttng_license); + if (EXTRA_VERSION_NAME[0] != '\0') { + MSG("\nExtra version name: " EXTRA_VERSION_NAME); + } + if (EXTRA_VERSION_DESCRIPTION[0] != '\0') { + MSG("\nExtra version description:\n\t" EXTRA_VERSION_DESCRIPTION); + } + if (EXTRA_VERSION_PATCHES[0] != '\0') { + MSG("\nExtra version patches:\n\t" EXTRA_VERSION_PATCHES); + } } end: