aboutsummaryrefslogtreecommitdiffstats
path: root/colorize.c
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2014-07-24 12:50:07 +0200
committerGravatar Steven Schubiger <stsc@refcnt.org> 2014-07-24 12:50:07 +0200
commitcbc423545a5b9952ef129a2c0bf6905d4b3912a7 (patch)
treede54d6b1bee2a419e5a8713cdfe455430487350e /colorize.c
parent32458f1006aa98c549909ebcdd731dec08f0c474 (diff)
downloadcolorize-cbc423545a5b9952ef129a2c0bf6905d4b3912a7.tar.gz
colorize-cbc423545a5b9952ef129a2c0bf6905d4b3912a7.tar.bz2
Merge duplicated version printing code
Diffstat (limited to 'colorize.c')
-rw-r--r--colorize.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/colorize.c b/colorize.c
index 30d03bc..7704c3b 100644
--- a/colorize.c
+++ b/colorize.c
@@ -408,6 +408,7 @@ print_version (void)
#else
const char *version = NULL;
#endif
+ const char *version_prefix, *version_string;
const char *c_flags;
struct bytes_size bytes_size;
bool debug;
@@ -421,10 +422,10 @@ print_version (void)
#else
debug = false;
#endif
- 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__);
+ version_prefix = version ? "" : "v";
+ version_string = version ? version : VERSION;
+ printf ("colorize %s%s (compiled at %s, %s)\n", version_prefix, version_string, __DATE__, __TIME__);
+
printf ("Compiler flags: %s\n", c_flags);
if (get_bytes_size (BUF_SIZE, &bytes_size))
{