diff options
author | midipix <writeonce@midipix.org> | 2016-04-25 11:28:26 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-10 23:35:42 -0500 |
commit | 017e12330c732c768de9e31e4782e3a2d6c08cc1 (patch) | |
tree | 85bffedf1f92c8987ab84d19c65c778aaea465fd /src | |
parent | b7025c26792a6f56fb96288dc3bedc74b356a001 (diff) | |
download | perk-017e12330c732c768de9e31e4782e3a2d6c08cc1.tar.bz2 perk-017e12330c732c768de9e31e4782e3a2d6c08cc1.tar.xz |
utility: integrated pe_source_version().
Diffstat (limited to 'src')
-rw-r--r-- | src/perk.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -8,7 +8,6 @@ #include <unistd.h> #include <perk/perk.h> #include <perk/perk_output.h> -#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) |