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(). --- Makefile.in | 1 - src/perk.c | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index d8ae066..abf9377 100644 --- a/Makefile.in +++ b/Makefile.in @@ -83,7 +83,6 @@ include $(PROJECT_DIR)/project/overrides.mk -$(APP_SRCS:%.c=%.o): version.tag $(APP_SRCS:%.c=%.o): CFLAGS_STATIC = $(CFLAGS_APP) src/%.lo: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag version.tag 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