summaryrefslogtreecommitdiff
path: root/src/slibtool.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-05-03 19:57:34 -0400
committermidipix <writeonce@midipix.org>2016-05-03 19:57:34 -0400
commitd723e1964c6329410375529fa8e4874ded4c3e2b (patch)
tree079e6e8be2e7ab1b9dd4f9d09912b3a7e24a38d5 /src/slibtool.c
parentddc3e662578c37074722923904701067738cb4bc (diff)
downloadslibtool-d723e1964c6329410375529fa8e4874ded4c3e2b.tar.bz2
slibtool-d723e1964c6329410375529fa8e4874ded4c3e2b.tar.xz
utility: --version: produce a clean output in tarball-based builds.
Diffstat (limited to 'src/slibtool.c')
-rw-r--r--src/slibtool.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/slibtool.c b/src/slibtool.c
index 7a1af20..24cd9be 100644
--- a/src/slibtool.c
+++ b/src/slibtool.c
@@ -17,7 +17,7 @@
static const char vermsg[] = "%s%s%s (git://midipix.org/slibtool): "
"version %s%d.%d.%d%s.\n"
- "[commit reference: %s%s%s]\n";
+ "%s%s%s%s%s\n";
static const char * const slbt_ver_color[6] = {
"\x1b[1m\x1b[35m","\x1b[0m",
@@ -35,15 +35,19 @@ static ssize_t slibtool_version(struct slbt_driver_ctx * dctx)
{
const struct slbt_source_version * verinfo;
const char * const * verclr;
+ bool gitver;
verinfo = slbt_source_version();
verclr = isatty(STDOUT_FILENO) ? slbt_ver_color : slbt_ver_plain;
+ gitver = strcmp(verinfo->commit,"unknown");
return fprintf(stdout,vermsg,
verclr[0],dctx->program,verclr[1],
verclr[2],verinfo->major,verinfo->minor,
verinfo->revision,verclr[3],
- verclr[4],verinfo->commit,verclr[5]);
+ gitver ? "[commit reference: " : "",
+ verclr[4],gitver ? verinfo->commit : "",
+ verclr[5],gitver ? "]" : "");
}
static void slibtool_perform_driver_actions(struct slbt_driver_ctx * dctx)