From: Fredrik Tolf Date: Sat, 13 Oct 2007 19:48:16 +0000 (+0200) Subject: Add -V switch to various programs for displaying version info. X-Git-Tag: 1.0~24 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=8af979f318c0e3d1d00a35996f6b5fecb055ac33;p=doldaconnect.git Add -V switch to various programs for displaying version info. --- diff --git a/Makefile.am b/Makefile.am index d81d47f..33f89f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,6 @@ SUBDIRS= common daemon include lib clients config po autopackage doc contrib ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = config.rpath + +dist-hook: + echo "tarball" >$(distdir)/source diff --git a/clients/gtk2/dolcon.c b/clients/gtk2/dolcon.c index 9da836b..c71b9a1 100644 --- a/clients/gtk2/dolcon.c +++ b/clients/gtk2/dolcon.c @@ -2208,18 +2208,22 @@ int main(int argc, char **argv) textdomain(PACKAGE); gtk_init(&argc, &argv); connlocal = 0; - while((c = getopt(argc, argv, "lh")) != -1) { + while((c = getopt(argc, argv, "lhV")) != -1) { switch(c) { case 'l': connlocal = 1; break; case 'h': - printf("usage: dolcon [-hl]\n"); + printf("usage: dolcon [-hlV]\n"); printf("\t-h\tDisplay this help message\n"); printf("\t-l\tConnect to the locally running daemon\n"); + printf("\t-V\tDisplay version info and exit\n"); + exit(0); + case 'V': + printf("%s", RELEASEINFO); exit(0); default: - fprintf(stderr, "usage: dolcon [-hl]\n"); + fprintf(stderr, "usage: dolcon [-hlV]\n"); exit(1); } } diff --git a/clients/gui-shell/dsh.c b/clients/gui-shell/dsh.c index 9aa6a8e..40ee546 100644 --- a/clients/gui-shell/dsh.c +++ b/clients/gui-shell/dsh.c @@ -559,7 +559,7 @@ int main(int argc, char **argv) #ifdef HAVE_NOTIFY notify_init("Dolda Connect"); #endif - while((c = getopt(argc, argv, "rhs:")) != -1) { + while((c = getopt(argc, argv, "Vrhs:")) != -1) { switch(c) { case 'r': remote = 1; @@ -573,6 +573,10 @@ int main(int argc, char **argv) printf("usage: doldacond-shell [-hr]\n"); printf("\t-h\tDisplay this help message\n"); printf("\t-r\tConnect to a remote host\n"); + printf("\t-V\tDisplay version info and exit\n"); + exit(0); + case 'V': + printf("%s", RELEASEINFO); exit(0); default: fprintf(stderr, "usage: doldacond-shell [-hr]\n"); diff --git a/clients/gui-shell/launch.c b/clients/gui-shell/launch.c index bef20ce..5cf716a 100644 --- a/clients/gui-shell/launch.c +++ b/clients/gui-shell/launch.c @@ -51,11 +51,12 @@ int main(int argc, char **argv) int c; char cf[1024], pf[1024]; - while((c = getopt(argc, argv, "h")) != -1) { + while((c = getopt(argc, argv, "hV")) != -1) { switch(c) { case 'h': - printf("usage: dolcon-launch [-h]\n"); + printf("usage: dolcon-launch [-hV]\n"); printf("\t-h\tDisplay this help message\n"); + printf("\t-V\tDisplay version info and exit\n"); printf("\n"); printf("\tIf $HOME/.doldacond.conf does not exist, dolcon-launch will run\n"); printf("\tdolconf. Otherwise, if $HOME/.doldacond.pid does not exist,\n"); @@ -63,7 +64,9 @@ int main(int argc, char **argv) printf("\tdoldacond-shell. Otherwise, dolcon-launch will run dolcon. All\n"); printf("\tthese programs must be somewhere in $PATH for dolcon-launch to work.\n"); exit(0); - break; + case 'V': + printf("%s", RELEASEINFO); + exit(0); default: fprintf(stderr, "usage: dolcon-launch [-h]\n"); exit(1); diff --git a/config/util/dolconf.c b/config/util/dolconf.c index 07c6077..75d89c7 100644 --- a/config/util/dolconf.c +++ b/config/util/dolconf.c @@ -763,7 +763,7 @@ int main(int argc, char **argv) gtk_init(&argc, &argv); state = -1; - while((c = getopt(argc, argv, "haw")) != -1) { + while((c = getopt(argc, argv, "hawV")) != -1) { switch(c) { case 'a': state = 1; @@ -776,9 +776,13 @@ int main(int argc, char **argv) printf("\t-h\tDisplay this help message\n"); printf("\t-a\tGo directly to the assistant\n"); printf("\t-w\tGo directly to the standard window\n"); + printf("\t-V\tDisplay version info and exit\n"); + exit(0); + case 'V': + printf("%s", RELEASEINFO); exit(0); default: - fprintf(stderr, "usage: dolconf [-haw]\n"); + fprintf(stderr, "usage: dolconf [-hawV]\n"); exit(1); } } diff --git a/configure.in b/configure.in index f90ec5f..d93efa0 100644 --- a/configure.in +++ b/configure.in @@ -243,6 +243,18 @@ CPPFLAGS="-I\$(top_srcdir)/include $CPPFLAGS" DOLDA_AC_GROUP([Writing output]) +AH_TEMPLATE(RELEASEINFO, [define release information reported by various programs (should be left to configure to define)]) +relinfo="relver ${VERSION}\\n" +relinfo="${relinfo}builddate $(date)\\n" +if test -d .git && which git-rev-parse >/dev/null 2>&1; then + relinfo="${relinfo}source git $(git-rev-parse HEAD)\\n" +elif test -r source; then + relinfo="${relinfo}source $(cat source)\\n" +else + relinfo="${relinfo}source unknown\\n" +fi +AC_DEFINE_UNQUOTED([RELEASEINFO], ["$relinfo"]) + AC_SUBST([extlibs]) AC_OUTPUT([ Makefile diff --git a/daemon/main.c b/daemon/main.c index 2848d41..551ed5c 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -390,7 +390,7 @@ int main(int argc, char **argv) syslogfac = LOG_DAEMON; configfile = NULL; pidfile = NULL; - while((c = getopt(argc, argv, "p:C:f:hns")) != -1) + while((c = getopt(argc, argv, "p:C:f:hnsV")) != -1) { switch(c) { @@ -436,11 +436,14 @@ int main(int argc, char **argv) case 's': immsyslog = 1; break; + case 'V': + printf("%s", RELEASEINFO); + exit(0); case 'h': case ':': case '?': default: - printf("usage: doldacond [-hns] [-C configfile] [-p pidfile] [-f facility]\n"); + printf("usage: doldacond [-hnsV] [-C configfile] [-p pidfile] [-f facility]\n"); exit(c != 'h'); } }