X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fversion.c;h=722804e8e51a875ab5f9f1cd3e6a3b750e02efb2;hp=8631cf9482cce8f853fa4dd8530a6c1f9bf600da;hb=87597c2c3bbaa1502ad2025cbf16704829f3b464;hpb=314d52225ce6d9b81d48b7645b035b1c93875369 diff --git a/src/bin/lttng/commands/version.c b/src/bin/lttng/commands/version.c index 8631cf948..722804e8e 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,11 +23,17 @@ #include #include #include -#include #include #include "../command.h" +#include "version.h" + +#ifdef LTTNG_EMBED_HELP +static const char help_msg[] = +#include +; +#endif enum { OPT_HELP = 1, @@ -43,19 +49,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,7 +58,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, FULL_VERSION, NAME_MAX); + strncpy(version->version_commit, GIT_VERSION, NAME_MAX); strncpy(version->version_name, VERSION_NAME, NAME_MAX); strncpy(version->package_url, PACKAGE_URL, NAME_MAX); } @@ -149,13 +142,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; } @@ -164,9 +156,10 @@ 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("Web site: https://lttng.org"); MSG("\n%s", lttng_license); }