Babeltrace: print correct version number
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Aug 2011 19:41:17 +0000 (15:41 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Aug 2011 19:41:17 +0000 (15:41 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace-log.c
converter/babeltrace.c
include/babeltrace/babeltrace.h

index 2b573bdeef22a0db7590b89de10a2efc4c71bdb3..7f9834c8e4cbffef83364b867fa57e744a283189 100644 (file)
@@ -20,6 +20,7 @@
  * Depends on glibc 2.10 for getline().
  */
 
+#include <config.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -89,11 +90,16 @@ static
 void print_metadata(FILE *fp)
 {
        char uuid_str[UUID_STR_LEN];
+       unsigned int major = 0, minor = 0;
+       int ret;
 
+       ret = sscanf(VERSION, "%u.%u", &major, &minor);
+       if (ret != 2)
+               fprintf(stderr, "[warning] Incorrect babeltrace version format\n.");
        uuid_unparse(s_uuid, uuid_str);
        fprintf(fp, metadata_fmt,
-               BABELTRACE_VERSION_MAJOR,
-               BABELTRACE_VERSION_MINOR,
+               major,
+               minor,
                uuid_str,
                BYTE_ORDER == LITTLE_ENDIAN ? "le" : "be",
                s_timestamp ? metadata_stream_event_header_timestamp : "");
@@ -245,9 +251,7 @@ void trace_text(FILE *input, int output)
 static
 void usage(FILE *fp)
 {
-       fprintf(fp, "BabelTrace Log Converter %u.%u\n",
-               BABELTRACE_VERSION_MAJOR,
-               BABELTRACE_VERSION_MINOR);
+       fprintf(fp, "BabelTrace Log Converter %s\n", VERSION);
        fprintf(fp, "\n");
        fprintf(fp, "Convert for a text log (read from standard input) to CTF.\n");
        fprintf(fp, "\n");
index 9d79c39d3a24b5f7139da59babce6f7a168bc7cf..ded493cede3e6c37c5d8d46de56452e0d82d6fa3 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #define _XOPEN_SOURCE 700
+#include <config.h>
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/format.h>
 #include <popt.h>
@@ -82,9 +83,7 @@ static void list_formats(FILE *fp)
 
 static void usage(FILE *fp)
 {
-       fprintf(fp, "BabelTrace Trace Converter %u.%u\n\n",
-               BABELTRACE_VERSION_MAJOR,
-               BABELTRACE_VERSION_MINOR);
+       fprintf(fp, "BabelTrace Trace Converter %s\n\n", VERSION);
        fprintf(fp, "usage : babeltrace [OPTIONS] INPUT <OUTPUT>\n");
        fprintf(fp, "\n");
        fprintf(fp, "  INPUT                          Input trace path\n");
index cb28eb79c11b1605ec4549222e60713a24a37a80..8091ac441d9d758f9d7a1c4897d7b2fc9c815b22 100644 (file)
@@ -4,9 +4,6 @@
 #include <stdio.h>
 #include <glib.h>
 
-#define BABELTRACE_VERSION_MAJOR       0
-#define BABELTRACE_VERSION_MINOR       1
-
 extern int babeltrace_verbose, babeltrace_debug;
 
 #define printf_verbose(fmt, args...)                           \
This page took 0.035833 seconds and 4 git commands to generate.