From 017e12330c732c768de9e31e4782e3a2d6c08cc1 Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 25 Apr 2016 11:28:26 -0400 Subject: utility: integrated pe_source_version(). --- src/perk.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/perk.c b/src/perk.c index 352d675..756c5a8 100644 --- a/src/perk.c +++ b/src/perk.c @@ -8,7 +8,6 @@ #include #include #include -#include "perk_version.h" #include "perk_driver_impl.h" #ifndef PERK_DRIVER_FLAGS @@ -16,18 +15,19 @@ | PERK_DRIVER_VERBOSITY_USAGE #endif -static const char vermsg[] = "%s (git://midipix.org/perk): commit %s.\n"; +static const char vermsg[] = "%s (git://midipix.org/perk): " + "version %d.%d.%d.\n" + "[commit reference: %s]\n"; static ssize_t perk_version(struct pe_driver_ctx * dctx) { - char buf[512]; - size_t len; + const struct pe_source_version * verinfo; - if (dctx->cctx->ioctx->fdout >= 0) { - len = sprintf(buf,vermsg,dctx->program,PERK_GIT_VERSION); - return write(dctx->cctx->ioctx->fdout,buf,len); - } else - return fprintf(stdout,vermsg,dctx->program,PERK_GIT_VERSION); + verinfo = pe_source_version(); + + return fprintf(stdout,vermsg,dctx->program, + verinfo->major,verinfo->minor,verinfo->revision, + verinfo->commit); } static ssize_t perk_paragraph_break(struct pe_unit_ctx * uctx, int * fpara) -- cgit v1.2.3