From 0896e57f054e513db14d37bd8602f3a261a9d24d Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Tue, 21 Oct 2008 13:03:36 -0400 Subject: [PATCH] Include info about the git-revision, if possible. --- src/Makefile.in | 4 ++++ src/help.c | 2 +- src/screen.c | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index 5be5d73..d8ee8d2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -22,6 +22,10 @@ bindir = $(exec_prefix)/bin VERSION = @VERSION@ SCREEN = screen-$(VERSION) +GIT = which git +GIT_REV = "`git-describe --always 2>/dev/null`" +DEFS = @DEFS@ -DGIT_REV=\"$(GIT_REV)\" + ETCSCREENRC = $(prefix)/etc/screenrc SCREENENCODINGS = $(datadir)/screen/utf8encodings diff --git a/src/help.c b/src/help.c index 3b71b25..7eeac15 100644 --- a/src/help.c +++ b/src/help.c @@ -28,7 +28,7 @@ #include "screen.h" #include "extern.h" -char version[40]; /* initialised by main() */ +char version[60]; /* initialised by main() */ extern struct layer *flayer; extern struct display *display, *displays; diff --git a/src/screen.c b/src/screen.c index 5dddee0..6dfcf21 100644 --- a/src/screen.c +++ b/src/screen.c @@ -399,8 +399,8 @@ char **av; #ifdef DEBUG opendebug(1, 0); #endif - sprintf(version, "%d.%.2d.%.2d%s (%s) %s", REV, VERS, - PATCHLEVEL, STATE, ORIGIN, DATE); + snprintf(version, 59, "%d.%.2d.%.2d%s (%s%s) %s", REV, VERS, + PATCHLEVEL, STATE, ORIGIN, GIT_REV, DATE); nversion = REV * 10000 + VERS * 100 + PATCHLEVEL; debug2("-- screen debug started %s (%s)\n", *av, version); #ifdef POSIX -- 2.11.4.GIT