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 f93359d..465beda 100644 (file)
@@ -2,15 +2,15 @@
 # Makefile for top level of mmh distribution
 #
 
 # Makefile for top level of mmh distribution
 #
 
-# mmh version
-VERSION = @VERSION@
-
 SHELL = /bin/sh
 @SET_MAKE@
 
 srcdir = @srcdir@
 VPATH  = @srcdir@
 
 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,
 # ========== USER CONFIGURATION SECTION ==========
 #
 # If `make' is executed in the directory containing this Makefile,
diff --git a/VERSION b/VERSION
index 52c4325..be58634 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3+dev
+0.3
index 47f9125..16af151 100644 (file)
@@ -2,9 +2,6 @@
 # Makefile for config subdirectory
 #
 
 # Makefile for config subdirectory
 #
 
-# nmh version
-VERSION = @VERSION@
-
 SHELL = /bin/sh
 
 top_srcdir = @top_srcdir@
 SHELL = /bin/sh
 
 top_srcdir = @top_srcdir@
@@ -42,15 +39,12 @@ COMPILE2 = $(CC) -c $(DEFS) $(CONFIGDEFS) $(INCLUDES) $(CFLAGS)
 SRCS = config.c
 
 # object files
 SRCS = config.c
 
 # object files
-OBJS = config.o version.o
+OBJS = config.o
 
 # ========= DEPENDENCIES FOR BUILDING ==========
 
 all: $(OBJS)
 
 
 # ========= DEPENDENCIES FOR BUILDING ==========
 
 all: $(OBJS)
 
-version.c:
-       ${srcdir}/version.sh $(VERSION) > version.c
-
 config.o: config.c
        $(COMPILE2) $(srcdir)/config.c
 
 config.o: config.c
        $(COMPILE2) $(srcdir)/config.c
 
@@ -66,7 +60,6 @@ mostlyclean:
        rm -f *.o *~
 
 clean: mostlyclean
        rm -f *.o *~
 
 clean: mostlyclean
-       rm -f version.c
 
 distclean: clean
        rm -f Makefile
 
 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 e1795ca..53b301e 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 *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>
 extern char *whatnowproc;
 
 #include <h/prototypes.h>
index abfcd41..49b2600 100644 (file)
@@ -2,7 +2,6 @@
 # Makefile for man subdirectory
 #
 
 # Makefile for man subdirectory
 #
 
-VERSION = @VERSION@
 DATE = @DATE@
 
 SHELL = /bin/sh
 DATE = @DATE@
 
 SHELL = /bin/sh
@@ -11,6 +10,8 @@ top_srcdir = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
+VERSION = `$(top_srcdir)/version.sh $(top_srcdir)`
+
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
 bindir      = @bindir@
 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' > $@
 # 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' >> $@
        @echo 's,%nmhdate%,$(DATE),g' >> $@
        @echo 's,%bindir%,$(bindir),g' >> $@
        @echo 's,%etcdir%,$(etcdir),g' >> $@
index f60bd9a..a9fa2d4 100644 (file)
@@ -8,6 +8,8 @@ top_srcdir = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
+VERSION = `$(top_srcdir)/version.sh $(top_srcdir)`
+
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
 bindir      = @bindir@
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
 bindir      = @bindir@
@@ -33,7 +35,7 @@ LINTFLAGS = @LINTFLAGS@
 
 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS)
 
 
 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS)
 
-LOCALLIBS = ../config/version.o ../config/config.o
+LOCALLIBS = ../config/config.o
 
 .SUFFIXES:
 .SUFFIXES: .c .o
 
 .SUFFIXES:
 .SUFFIXES: .c .o
@@ -94,14 +96,16 @@ dtimep.c: dtimep.lex
 
 pidstatus.o: sigmsg.h
 
 
 pidstatus.o: sigmsg.h
 
-libmh.a: $(OBJS) $(LOCALLIBS)
+libmh.a: $(OBJS) $(LOCALLIBS) version.c
        rm -f $@
        rm -f $@
+       $(COMPILE) -DVERSION="\"$(VERSION)\"" -o version.o $(srcdir)/version.c
        if test x$(LIBTOOL) != x -a x$(GNU_LIBTOOL) = x ; then \
        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 \
        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
          $(RANLIB) libmh.a  ; \
        fi
+       rm -f version.o
 
 install:
 
 
 install:
 
index 8361c66..7223390 100644 (file)
@@ -12,5 +12,8 @@
 void
 print_version(char *invo_name)
 {
 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 d7cad06..e7e7b46 100644 (file)
@@ -8,6 +8,8 @@ top_srcdir = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
+VERSION = `$(top_srcdir)/version.sh $(top_srcdir)`
+
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
 bindir      = @bindir@
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
 bindir      = @bindir@
@@ -31,7 +33,7 @@ LINTFLAGS = @LINTFLAGS@
 TERMLIB = @TERMLIB@
 LEXLIB  = @LEXLIB@
 
 TERMLIB = @TERMLIB@
 LEXLIB  = @LEXLIB@
 
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS)
+COMPILE = $(CC) -c $(DEFS) -DVERSION="\"$(VERSION)\"" $(INCLUDES) $(CFLAGS)
 LINK    = $(CC) $(LDFLAGS) -o $@
 LN = ln
 
 LINK    = $(CC) $(LDFLAGS) -o $@
 LN = ln
 
index 9ab6515..d4c6c7f 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -40,6 +40,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static int pos = 1;
 
 extern struct aka *akahead;
 static int pos = 1;
 
 extern struct aka *akahead;
index 9e287be..33d2b49 100644 (file)
@@ -53,6 +53,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** static prototypes
 */
 /*
 ** static prototypes
 */
index 9d35601..41eae6a 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -31,6 +31,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static struct format *fmt;
 
 static int dat[5];
 static struct format *fmt;
 
 static int dat[5];
index a68420a..12d1f9d 100644 (file)
@@ -25,6 +25,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char delim3[] = "-------";
 
 struct smsg {
 static char delim3[] = "-------";
 
 struct smsg {
index c34ce43..75bbf86 100644 (file)
@@ -31,6 +31,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
 
 int
 main(int argc, char **argv)
index d74e498..1d5c3aa 100644 (file)
@@ -31,6 +31,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
 
 int
 main(int argc, char **argv)
index 3a01995..70162b2 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -26,6 +26,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static struct format *fmt;
 
 static int dat[5];
 static struct format *fmt;
 
 static int dat[5];
index 63fcb0f..73ad5f2 100644 (file)
@@ -60,6 +60,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 struct Folder {
        char *name;  /* name of folder */
        int priority;
 struct Folder {
        char *name;  /* name of folder */
        int priority;
index d75849b..419d8ee 100644 (file)
@@ -23,6 +23,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /* for assignlabel */
 static struct format *lvec[128];
 static int lused = 0;
 /* for assignlabel */
 static struct format *lvec[128];
 static int lused = 0;
index 3e3cd76..b7cdfe5 100644 (file)
@@ -64,6 +64,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { 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? */
 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 d8d69f7..e00ae0e 100644 (file)
@@ -44,6 +44,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char drft[BUFSIZ];
 static struct msgs *mp = NULL;
 
 static char drft[BUFSIZ];
 static struct msgs *mp = NULL;
 
index 08aa533..e31c6a6 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -74,6 +74,8 @@ static struct swit switches[] = {
        { NULL, 0 },
 };
 
        { NULL, 0 },
 };
 
+char *version=VERSION;
+
 /*
 ** This is an attempt to simplify things by putting all the
 ** privilege ops into macros.
 /*
 ** This is an attempt to simplify things by putting all the
 ** privilege ops into macros.
index 1e57d1c..72b6d8e 100644 (file)
@@ -40,6 +40,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** static prototypes
 */
 /*
 ** static prototypes
 */
index 6ed6037..a233c68 100644 (file)
@@ -45,6 +45,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /*
 ** Directory to place tmp files.  This must
 
 /*
 ** Directory to place tmp files.  This must
index c089d8e..a84703b 100644 (file)
--- a/uip/mhl.c
+++ b/uip/mhl.c
@@ -61,6 +61,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { 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                 */
 #define NOCOMPONENT 0x000001  /* don't show component name   */
 #define UPPERCASE   0x000002  /* display in all upper case   */
 #define CENTER      0x000004  /* center line                 */
index c9194cc..7056db5 100644 (file)
@@ -40,6 +40,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
index 06630b3..4215ecf 100644 (file)
@@ -32,6 +32,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char tmpfil[BUFSIZ];
 
 /*
 static char tmpfil[BUFSIZ];
 
 /*
index 29d4170..2c61e60 100644 (file)
@@ -28,6 +28,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 struct proc {
        char *p_name;
        char **p_field;
 struct proc {
        char *p_name;
        char **p_field;
@@ -41,8 +43,8 @@ char *empty = "";
 */
 static struct proc procs [] = {
        { "#--Version--", &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 },
 
        { "#--Path-and-File-Names--", &empty },
        { "mypath",          &mypath },
index 0fe638c..31e0722 100644 (file)
@@ -20,6 +20,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 int
 main(int argc, char **argv)
 {
 int
 main(int argc, char **argv)
 {
index e39bf65..be9cd45 100644 (file)
@@ -42,6 +42,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
index 596df72..47b7c02 100644 (file)
@@ -40,6 +40,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
index cecf2ee..d4bf6a6 100644 (file)
@@ -42,6 +42,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
 
 /* mhparse.c */
 extern char *tmp;  /* directory to place temp files */
index efbea04..9763376 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -33,6 +33,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static enum { NEW, FNEXT, FPREV, UNSEEN } run_mode = NEW;
 
 /*
 static enum { NEW, FNEXT, FPREV, UNSEEN } run_mode = NEW;
 
 /*
index a8c2c42..fe1102c 100644 (file)
@@ -23,6 +23,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
 
 int
 main(int argc, char **argv)
index 7d9c086..4cb33fb 100644 (file)
@@ -70,6 +70,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** static prototypes
 */
 /*
 ** static prototypes
 */
index ea17b91..7f71e02 100644 (file)
@@ -38,6 +38,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 volatile sig_atomic_t wtuser = 0;
 volatile sig_atomic_t sigint = 0;
 
 volatile sig_atomic_t wtuser = 0;
 volatile sig_atomic_t sigint = 0;
index d08058b..af3fc10 100644 (file)
@@ -26,6 +26,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char backup[BUFSIZ] = "";
 static char drft[BUFSIZ] = "";
 static char tmpfil[BUFSIZ] = "";
 static char backup[BUFSIZ] = "";
 static char drft[BUFSIZ] = "";
 static char tmpfil[BUFSIZ] = "";
index bd6bacb..b4e37bd 100644 (file)
@@ -22,6 +22,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
 
 int
 main(int argc, char **argv)
index 83c5150..33f8f3b 100644 (file)
@@ -43,6 +43,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /*
 ** name of temporary file to store incoming message
 
 /*
 ** name of temporary file to store incoming message
index 182f315..682f66a 100644 (file)
@@ -31,6 +31,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static char maildir[BUFSIZ];
 
 struct st_fold {
 static char maildir[BUFSIZ];
 
 struct st_fold {
index 8a40543..b2adebf 100644 (file)
@@ -60,6 +60,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 static struct swit ccswitches[] = {
 #define CTOSW  0
        { "to", 0 },
 static struct swit ccswitches[] = {
 #define CTOSW  0
        { "to", 0 },
index e435a27..273477e 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -25,6 +25,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** static prototypes
 */
 /*
 ** static prototypes
 */
index 99820e9..5059383 100644 (file)
--- a/uip/rmm.c
+++ b/uip/rmm.c
@@ -24,6 +24,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
 
 int
 main(int argc, char **argv)
index a735b31..018cd9c 100644 (file)
@@ -30,6 +30,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
 
 int
 main(int argc, char **argv)
index eac15ae..d7691db 100644 (file)
@@ -73,6 +73,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
 
 int
 main(int argc, char **argv)
index 9306f94..df0dc7f 100644 (file)
@@ -72,6 +72,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { 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 */
 
 static int globbed = 0;  /* have we built "vars" table yet? */
 static int parsed = 0;  /* have we built header field table yet */
index ff69bc9..c56a401 100644 (file)
@@ -41,6 +41,8 @@ static struct swit switches[] = {
         { NULL, 0 }
 };
 
         { NULL, 0 }
 };
 
+char *version=VERSION;
+
 struct smsg {
        int s_msg;
        time_t s_clock;
 struct smsg {
        int s_msg;
        time_t s_clock;
index 505b94c..39d8ada 100644 (file)
@@ -39,6 +39,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 /* flags for headers->flags */
 #define HNOP  0x0000  /* just used to keep .set around */
 
 /* flags for headers->flags */
 #define HNOP  0x0000  /* just used to keep .set around */
index 45671ed..be046ac 100644 (file)
@@ -32,6 +32,8 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
+
 /*
 ** Options at the "whatnow" prompt
 */
 /*
 ** Options at the "whatnow" prompt
 */
index 7486dd8..64ec7c9 100644 (file)
@@ -37,6 +37,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 #define NFILES 32
 
 
 #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"