* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <popt.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <config.h>
#include <common/mi-lttng.h>
{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
*/
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);
}
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;
}
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);
+ }
}
end: