sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

commit 69f77f767e52e21b1a40182d03180da73f2f9021
parent 12b8b8a338d1791ce2d200f7cad99c9f0b5804d1
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sun, 10 Oct 2021 23:04:06 +0200

Add an ident version string to the binary

This lets users get the current binary version
using what(1) in an automated way.

Diffstat:
MMakefile | 2+-
Mconfig.mk | 5+++++
Msacc.c | 2++
3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -33,7 +33,7 @@ uninstall: # Stock FLAGS SACCCFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_GNU_SOURCE \ - $(IOCFLAGS) $(CFLAGS) + -DVERSION=\"$(GETVER)\" $(IOCFLAGS) $(CFLAGS) .c.o: $(CC) $(SACCCFLAGS) -c $< diff --git a/config.mk b/config.mk @@ -2,6 +2,11 @@ PREFIX = /usr/local MANDIR = $(PREFIX)/share/man/man1 +# Version to put in the ident string +VERSION = "1.03" +GETVER = $$(git rev-parse --is-inside-work-tree >/dev/null 2>&1 && \ + git describe --tags || echo $(VERSION)) + # UI type # txt (textual) #UI=txt diff --git a/sacc.c b/sacc.c @@ -22,6 +22,8 @@ #include "io.h" #include "config.h" +const char ident[] = "@(#) sacc(omys): " VERSION; + static char *mainurl; static Item *mainentry; static int devnullfd;