]> git.marmaro.de Git - mmh/commitdiff
redesign version string
authorPhilipp Takacs <philipp@bureaucracy.de>
Sun, 4 Sep 2016 12:12:00 +0000 (14:12 +0200)
committerPhilipp Takacs <philipp@bureaucracy.de>
Sun, 18 Sep 2016 10:26:46 +0000 (12:26 +0200)
Now we have two version nummbers one for the tool
and one for the lib. Also the version number is changed
everytime the object is rebuild.

51 files changed:
Makefile.in
VERSION
config/Makefile.in
config/version.sh [deleted file]
h/mh.h
man/Makefile.in
sbr/Makefile.in
sbr/print_version.c
sbr/version.c [new file with mode: 0644]
uip/Makefile.in
uip/ali.c
uip/anno.c
uip/ap.c
uip/burst.c
uip/comp.c
uip/dist.c
uip/dp.c
uip/flist.c
uip/fmtdump.c
uip/folder.c
uip/forw.c
uip/inc.c
uip/mark.c
uip/mhbuild.c
uip/mhl.c
uip/mhlist.c
uip/mhmail.c
uip/mhparam.c
uip/mhpath.c
uip/mhshow.c
uip/mhstore.c
uip/mhtest.c
uip/new.c
uip/packf.c
uip/pick.c
uip/prompter.c
uip/rcvdist.c
uip/rcvpack.c
uip/rcvstore.c
uip/refile.c
uip/repl.c
uip/rmf.c
uip/rmm.c
uip/scan.c
uip/send.c
uip/slocal.c
uip/sortm.c
uip/spost.c
uip/whatnow.c
uip/whom.c
version.sh [new file with mode: 0755]

index f93359dfa55812f89d0d7e65ed56bd5709b73809..465beda0daf5aa212d56c6f3b61cdf32f9e0828e 100644 (file)
@@ -2,15 +2,15 @@
 # Makefile for top level of mmh distribution
 #
 
-# mmh version
-VERSION = @VERSION@
-
 SHELL = /bin/sh
 @SET_MAKE@
 
 srcdir = @srcdir@
 VPATH  = @srcdir@
 
+# mmh version
+VERSION    = `sed q $(srcdir)/VERSION`
+
 # ========== USER CONFIGURATION SECTION ==========
 #
 # If `make' is executed in the directory containing this Makefile,
diff --git a/VERSION b/VERSION
index 52c43259d20ce81419201c39d1f7e96177454053..be586341736ee60d6ca2be0f3762a307e8fe79f9 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3+dev
+0.3
index 47f9125b22776da2fa0a09761137655373764e10..16af15167a143148f08ef5b57ac74425bf2517d7 100644 (file)
@@ -2,9 +2,6 @@
 # Makefile for config subdirectory
 #
 
-# nmh version
-VERSION = @VERSION@
-
 SHELL = /bin/sh
 
 top_srcdir = @top_srcdir@
@@ -42,15 +39,12 @@ COMPILE2 = $(CC) -c $(DEFS) $(CONFIGDEFS) $(INCLUDES) $(CFLAGS)
 SRCS = config.c
 
 # object files
-OBJS = config.o version.o
+OBJS = config.o
 
 # ========= DEPENDENCIES FOR BUILDING ==========
 
 all: $(OBJS)
 
-version.c:
-       ${srcdir}/version.sh $(VERSION) > version.c
-
 config.o: config.c
        $(COMPILE2) $(srcdir)/config.c
 
@@ -66,7 +60,6 @@ mostlyclean:
        rm -f *.o *~
 
 clean: mostlyclean
-       rm -f version.c
 
 distclean: clean
        rm -f Makefile
diff --git a/config/version.sh b/config/version.sh
deleted file mode 100755 (executable)
index 6396306..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-#
-# version.sh -- script to create version string(s) for mmh.
-#
-# You need to pass the script the version number to use.
-#
-
-if [ -z "$1" ]; then
-       echo "usage: version.sh VERSION" 1>&2
-       exit 1
-fi
-
-VERSION=$1
-
-git_info="$(git show --pretty'=format: [%h -- %cD]' HEAD | head -n1)"
-
-echo "char *version_str = \"mmh-${VERSION}${git_info}\";"
-echo "char *version_num = \"mmh-$VERSION\";"
diff --git a/h/mh.h b/h/mh.h
index e1795caa1b681466ada5b4f6af22ee41d6c2a0ae..53b301e5692a1c67fdf39ed2196259f7c86cc1aa 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -304,8 +304,8 @@ extern char *seq_unseen;
 extern char *seq_neg;
 extern char *trashfolder;
 extern char *usequence;
-extern char *version_num;
-extern char *version_str;
+extern char *version;
+extern char *lib_version;
 extern char *whatnowproc;
 
 #include <h/prototypes.h>
index abfcd4143da770a901467673e700e00706bdf75f..49b260046d476221381b47907c25af96ecc62a24 100644 (file)
@@ -2,7 +2,6 @@
 # Makefile for man subdirectory
 #
 
-VERSION = @VERSION@
 DATE = @DATE@
 
 SHELL = /bin/sh
@@ -11,6 +10,8 @@ top_srcdir = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
+VERSION = `$(top_srcdir)/version.sh $(top_srcdir)`
+
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
 bindir      = @bindir@
@@ -87,7 +88,7 @@ $(MAN1) $(MAN5) $(MAN7) $(MAN8): man.sed
 # create the sed file for building man pages
 man.sed: Makefile titles
        @echo 's,%nmhwarning%,THIS FILE HAS BEEN AUTOMATICALLY GENERATED.  DO NOT EDIT.,g' > $@
-       @echo 's,%nmhversion%,mmh-$(VERSION),g' >> $@
+       @echo 's,%nmhversion%,'$(VERSION)',g' >> $@
        @echo 's,%nmhdate%,$(DATE),g' >> $@
        @echo 's,%bindir%,$(bindir),g' >> $@
        @echo 's,%etcdir%,$(etcdir),g' >> $@
index f60bd9aa4245113c31ff8479cc1ccf85c911f577..a9fa2d4b7823bff5dbdee3ea6d5f67c036f94b1f 100644 (file)
@@ -8,6 +8,8 @@ top_srcdir = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
+VERSION = `$(top_srcdir)/version.sh $(top_srcdir)`
+
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
 bindir      = @bindir@
@@ -33,7 +35,7 @@ LINTFLAGS = @LINTFLAGS@
 
 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS)
 
-LOCALLIBS = ../config/version.o ../config/config.o
+LOCALLIBS = ../config/config.o
 
 .SUFFIXES:
 .SUFFIXES: .c .o
@@ -94,14 +96,16 @@ dtimep.c: dtimep.lex
 
 pidstatus.o: sigmsg.h
 
-libmh.a: $(OBJS) $(LOCALLIBS)
+libmh.a: $(OBJS) $(LOCALLIBS) version.c
        rm -f $@
+       $(COMPILE) -DVERSION="\"$(VERSION)\"" -o version.o $(srcdir)/version.c
        if test x$(LIBTOOL) != x -a x$(GNU_LIBTOOL) = x ; then \
-         $(LIBTOOL) -static -c -o libmh.a $(OBJS) $(LOCALLIBS) ; \
+         $(LIBTOOL) -static -c -o libmh.a $(OBJS) $(LOCALLIBS) version.o; \
        else \
-         ar cr libmh.a `$(LORDER) $(OBJS) $(LOCALLIBS) | $(TSORT) 2>/dev/null`  ; \
+         ar cr libmh.a `$(LORDER) $(OBJS) $(LOCALLIBS) version.o | $(TSORT) 2>/dev/null`  ; \
          $(RANLIB) libmh.a  ; \
        fi
+       rm -f version.o
 
 install:
 
index 8361c664eaae53694b828957079da1b7c2db2ff8..72233908270892025e4a150e304cd0a94152d7ca 100644 (file)
@@ -12,5 +12,8 @@
 void
 print_version(char *invo_name)
 {
-       printf("%s -- %s\n", invo_name, version_str);
+       printf("%s -- %s\n", invo_name, version);
+       if (strcmp(version, lib_version)!=0) {
+               printf("libversion: %s\n", lib_version);
+       }
 }
diff --git a/sbr/version.c b/sbr/version.c
new file mode 100644 (file)
index 0000000..42917c5
--- /dev/null
@@ -0,0 +1,3 @@
+#include <h/mh.h>
+
+char *lib_version = VERSION;
index d7cad062e1ccb5817b9bbc18d857014fd1294292..e7e7b46d6979752354089c139b93958c5144095f 100644 (file)
@@ -8,6 +8,8 @@ top_srcdir = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
+VERSION = `$(top_srcdir)/version.sh $(top_srcdir)`
+
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
 bindir      = @bindir@
@@ -31,7 +33,7 @@ LINTFLAGS = @LINTFLAGS@
 TERMLIB = @TERMLIB@
 LEXLIB  = @LEXLIB@
 
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS)
+COMPILE = $(CC) -c $(DEFS) -DVERSION="\"$(VERSION)\"" $(INCLUDES) $(CFLAGS)
 LINK    = $(CC) $(LDFLAGS) -o $@
 LN = ln
 
index 9ab6515eba32990a9f3fd1ccf358c8ef6279c807..d4c6c7fb20e98371bc1ac9a43d66c82f40610fb9 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -40,6 +40,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static int pos = 1;
 
 extern struct aka *akahead;
index 9e287be4a3a7b94b68c0fcc52a0d829cea9958da..33d2b49dec03d53c781946c15098b9f92a219862 100644 (file)
@@ -53,6 +53,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** static prototypes
 */
index 9d3560184e50fdc7570766fa5050a4478613fdc0..41eae6a2274964b28422475640f542f40af57a31 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -31,6 +31,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static struct format *fmt;
 
 static int dat[5];
index a68420a129b7f1d6b911ffea870ae2d9bc3ca006..12d1f9d408b2809eba2671a4590e54919be933ab 100644 (file)
@@ -25,6 +25,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char delim3[] = "-------";
 
 struct smsg {
index c34ce43f07d4c0e380c371bc6e8d7991d344c822..75bbf86fd667e61c9b0f45702f6baae8e7bb3073 100644 (file)
@@ -31,6 +31,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
index d74e498b0e20d57e927637fac77cb701bb6c4119..1d5c3aa4c41b8713c82586a9d4bc58f4db39f1f4 100644 (file)
@@ -31,6 +31,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
index 3a019951c0f4ecdd7f70d65699b96c3a9c6aee44..70162b2a0b1055b5134a5032fc08f101d9397765 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -26,6 +26,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static struct format *fmt;
 
 static int dat[5];
index 63fcb0f50aff921d5aafbb27ec56d6cd9cc4bc72..73ad5f298c74eefbb11ebe668932dbcb7820eadb 100644 (file)
@@ -60,6 +60,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 struct Folder {
        char *name;  /* name of folder */
        int priority;
index d75849b53dccb0f5339f3664bfcf2009cc224835..419d8eea8d444d8a64dd969d24db6b718053ad6e 100644 (file)
@@ -23,6 +23,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /* for assignlabel */
 static struct format *lvec[128];
 static int lused = 0;
index 3e3cd760804afa8c0bf37974787eb08fa03f39c0..b7cdfe54d132448fed24aa48c50324e1689155c2 100644 (file)
@@ -64,6 +64,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static int fshort   = 0;  /* output only folder names */
 static int fcreat   = 0;  /* should we ask to create new folders? */
 static int fpack    = 0;  /* are we packing the folder? */
index d8d69f7865049d1c23c24475e9555b80ea2adc7a..e00ae0e1cbd6d2181dc284a4a7ed69646f7b36de 100644 (file)
@@ -44,6 +44,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char drft[BUFSIZ];
 static struct msgs *mp = NULL;
 
index 08aa533ceb5121edc9a886be4bc3373f6b9d3d37..e31c6a627076197567c5ca671227096e08098da1 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -74,6 +74,8 @@ static struct swit switches[] = {
        { NULL, 0 },
 };
 
+char *version=VERSION;
+
 /*
 ** This is an attempt to simplify things by putting all the
 ** privilege ops into macros.
index 1e57d1cc8693696c1c134b5ccfe3a15edeef2d34..72b6d8e03b978f9aaa4073199ded7008059886b8 100644 (file)
@@ -40,6 +40,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** static prototypes
 */
index 6ed6037d34f7d27d15c5696b5fb8d75c92ad40b3..a233c685cd5dc1ea5217ba306b958b574f7a9a72 100644 (file)
@@ -45,6 +45,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /*
 ** Directory to place tmp files.  This must
index c089d8e0bab3a6500b0a732d13d1aeb8bb44696a..a84703b8ba6404ba999fd5f59228b508a96a7a9d 100644 (file)
--- a/uip/mhl.c
+++ b/uip/mhl.c
@@ -61,6 +61,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 #define NOCOMPONENT 0x000001  /* don't show component name   */
 #define UPPERCASE   0x000002  /* display in all upper case   */
 #define CENTER      0x000004  /* center line                 */
index c9194cc090b0fcf7e3a0d2b27335853945257241..7056db5f7618f71c7cfd22c8840c1a8996d914e0 100644 (file)
@@ -40,6 +40,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
index 06630b3bce882711d03b8eed3d2b6c73f065a44f..4215ecf24f0bab3e4a34a417d1a3cf62cdb63850 100644 (file)
@@ -32,6 +32,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char tmpfil[BUFSIZ];
 
 /*
index 29d4170df4ac251c32c0957c78f8753cf51d8b12..2c61e608076236bb2042a0b4d414215412dc7686 100644 (file)
@@ -28,6 +28,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 struct proc {
        char *p_name;
        char **p_field;
@@ -41,8 +43,8 @@ char *empty = "";
 */
 static struct proc procs [] = {
        { "#--Version--", &empty },
-       { "version",          &version_num },
-       { "version-str",      &version_str },
+       { "version",          &version },
+       { "lib-version",      &lib_version },
 
        { "#--Path-and-File-Names--", &empty },
        { "mypath",          &mypath },
index 0fe638cd7eec06e24a3e3a140b3d90c897ae69bb..31e0722e99b0da36c3775474e00eb88ea5b7018c 100644 (file)
@@ -20,6 +20,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 int
 main(int argc, char **argv)
 {
index e39bf65af13cbd687aff826d2e9e624124982bf4..be9cd45448109e71f27c571d31e2351391cf8c86 100644 (file)
@@ -42,6 +42,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
index 596df72853c94155716f6cc9ff15ac815b2f1a1f..47b7c025075ffff66a6cdf4e98ae6471c71cdaf5 100644 (file)
@@ -40,6 +40,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
index cecf2ee562120dd9ff91fbcf2d41870840b2eccb..d4bf6a6a05b107a4e7e167a42fa520fdffd5ed4a 100644 (file)
@@ -42,6 +42,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
index efbea0439c648920c263e7e20142328eedfcee8b..976337664d2909e3de4a9209130924f35a843cde 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -33,6 +33,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static enum { NEW, FNEXT, FPREV, UNSEEN } run_mode = NEW;
 
 /*
index a8c2c421a40cba44f32e73aa4b5e2170d4f45390..fe1102c66338af9767b58f1bc127998eba2fcc62 100644 (file)
@@ -23,6 +23,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
index 7d9c086994b22fecaf273054329f912ec247d3f2..4cb33fb189b7aa92494543ff65234022d6c2d246 100644 (file)
@@ -70,6 +70,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** static prototypes
 */
index ea17b91a0194e0891291821da1eebca8748d47d5..7f71e028be4b43affaa581d1cccddfcb6cc0c0f4 100644 (file)
@@ -38,6 +38,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 volatile sig_atomic_t wtuser = 0;
 volatile sig_atomic_t sigint = 0;
index d08058be6c76bc789a82c8dbf654545ea4d8300c..af3fc10d0511ec34a1206bddb674dc26436e4773 100644 (file)
@@ -26,6 +26,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char backup[BUFSIZ] = "";
 static char drft[BUFSIZ] = "";
 static char tmpfil[BUFSIZ] = "";
index bd6bacbf1d5b0de2fdddada4b110ae13934caa9f..b4e37bdea0a4928b634a08fdadff6dacebb13e23 100644 (file)
@@ -22,6 +22,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
index 83c5150ff51a606824666259e69f9278bd59f947..33f8f3bcedd3f0bc6ce4720cd52702dba1bdc791 100644 (file)
@@ -43,6 +43,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /*
 ** name of temporary file to store incoming message
index 182f315ea1836b3c7378a9e0899ba742cac36fd3..682f66a5c84d7d23cb2cc9cda544e6c28bea7ad2 100644 (file)
@@ -31,6 +31,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char maildir[BUFSIZ];
 
 struct st_fold {
index 8a405439acb6b846fc4576fa2e23b6390d7b8a0b..b2adebfea5cd53b1d668490ab1e37b10da5f1242 100644 (file)
@@ -60,6 +60,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static struct swit ccswitches[] = {
 #define CTOSW  0
        { "to", 0 },
index e435a276892449e84b2aafa718b3671c8f877e1c..273477e5fad21566dab03c723a341453afd9b139 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -25,6 +25,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** static prototypes
 */
index 99820e946130009ced6d47446cf286a8e0003ec5..5059383d74c135b8d77b51700f4504e89111df18 100644 (file)
--- a/uip/rmm.c
+++ b/uip/rmm.c
@@ -24,6 +24,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
index a735b315e36606900bcb81457883840a8bff1d85..018cd9cd9791bfc5eb0b06590d5e4839e27e0216 100644 (file)
@@ -30,6 +30,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
index eac15aee16e04cd9b9081549e6178157dd081226..d7691db99a332a57c9ddc6322303cc6371b7bd91 100644 (file)
@@ -73,6 +73,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
index 9306f94b0fdeee6f1288ba9e3dcc9d1d21ea3806..df0dc7f6524066892a0509ed1dd5228be5e06d44 100644 (file)
@@ -72,6 +72,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 static int globbed = 0;  /* have we built "vars" table yet? */
 static int parsed = 0;  /* have we built header field table yet */
index ff69bc9e2b8a1ebe4fa1558c33f1c2c5faae933f..c56a40190be02ffc95addb58b31b092f0aebb1c0 100644 (file)
@@ -41,6 +41,8 @@ static struct swit switches[] = {
         { NULL, 0 }
 };
 
+char *version=VERSION;
+
 struct smsg {
        int s_msg;
        time_t s_clock;
index 505b94ce951ed2759c9ee242a2704072ea009bdf..39d8ada53dfb99f8b35888ac62d290e53d7ed978 100644 (file)
@@ -39,6 +39,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* flags for headers->flags */
 #define HNOP  0x0000  /* just used to keep .set around */
index 45671ed365f5e6b6a3b11b6c3fd4ab76e9bb9f8d..be046ac79f632fadc3dfb6838abab206988ed4c7 100644 (file)
@@ -32,6 +32,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** Options at the "whatnow" prompt
 */
index 7486dd897f0dbb3315efbf6edd084724681d18b5..64ec7c973e0a3659a69618e588bd3274b5086eb4 100644 (file)
@@ -37,6 +37,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 #define NFILES 32
 
diff --git a/version.sh b/version.sh
new file mode 100755 (executable)
index 0000000..9c868de
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# version.sh -- script to create version string(s) for mmh.
+#
+# You can pass the top soucre directory to the script.
+#
+
+if [ -d "$1" ]
+then
+       cd "$1"
+fi
+
+if [ ! -f VERSION ]
+then
+       echo "No version file found" 1>&2
+       echo "usage: $0 [mmh-sourcedir]" 1>&2
+       exit 1
+fi
+
+version="`sed q VERSION`"
+
+git_info=""
+
+if [ -d ".git" ]; then
+       current=`git log -n 1 --pretty=format:+%h HEAD`
+       release=`git log -n 1 --pretty=format:+%h "mmh-$version"`
+       if [ "$current" != "$release" ]
+       then
+               git_info="$current"
+       fi
+fi
+
+echo mmh-"$version""$git_info"