aboutsummaryrefslogtreecommitdiffstats
path: root/colorize.c
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2014-06-26 16:08:37 +0200
committerGravatar Steven Schubiger <stsc@refcnt.org> 2014-06-26 16:08:37 +0200
commit5f02f11890b79f3254fbafa67ee6600982953856 (patch)
treea1948041408bdbbc4ab2067a6a15b6936061ea61 /colorize.c
parent055b7ca1312376f2fdf214176a1ae782d05f5396 (diff)
downloadcolorize-5f02f11890b79f3254fbafa67ee6600982953856.tar.gz
colorize-5f02f11890b79f3254fbafa67ee6600982953856.tar.bz2
Include commit hash in version output
Extracting the abbreviated commit hash will break when git will be replaced by a different version control system. But until it does, get the hash from the git repository.
Diffstat (limited to 'colorize.c')
-rw-r--r--colorize.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/colorize.c b/colorize.c
index 54f6889..ea18425 100644
--- a/colorize.c
+++ b/colorize.c
@@ -403,6 +403,11 @@ print_help (void)
static void
print_version (void)
{
+#ifdef HAVE_VERSION
+# include "version.h"
+#else
+ const char *version = NULL;
+#endif
const char *c_flags;
struct bytes_size bytes_size;
bool debug;
@@ -416,7 +421,10 @@ print_version (void)
#else
debug = false;
#endif
- printf ("%s v%s (compiled at %s, %s)\n", "colorize", VERSION, __DATE__, __TIME__);
+ if (version)
+ printf ("colorize %s (compiled at %s, %s)\n", version, __DATE__, __TIME__);
+ else
+ printf ("colorize v%s (compiled at %s, %s)\n", VERSION, __DATE__, __TIME__);
printf ("Compiler flags: %s\n", c_flags);
if (get_bytes_size (BUF_SIZE, &bytes_size))
{