tAdd an ident version string to the binary - sacc - sacc (saccomys): simple gopher client. (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- (DIR) commit 69f77f767e52e21b1a40182d03180da73f2f9021 (DIR) parent 12b8b8a338d1791ce2d200f7cad99c9f0b5804d1 (HTM) 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: M Makefile | 2 +- M config.mk | 5 +++++ M sacc.c | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) --- (DIR) diff --git a/Makefile b/Makefile t@@ -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 $< (DIR) diff --git a/config.mk b/config.mk t@@ -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 (DIR) diff --git a/sacc.c b/sacc.c t@@ -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;