]> www.dolda2000.com Git - doldaconnect.git/commitdiff
Add -V switch to various programs for displaying version info.
authorFredrik Tolf <fredrik@dolda2000.com>
Sat, 13 Oct 2007 19:48:16 +0000 (21:48 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Sat, 13 Oct 2007 19:49:54 +0000 (21:49 +0200)
Makefile.am
clients/gtk2/dolcon.c
clients/gui-shell/dsh.c
clients/gui-shell/launch.c
config/util/dolconf.c
configure.in
daemon/main.c

index d81d47ffa25de8bd0833e08ca97f76725c7e1aa4..33f89f9cfc14de4715ebbe3d3734ce1653310004 100644 (file)
@@ -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
index 9da836b8fd3ebadb7e8006ecf5141ac9ece0b65d..c71b9a1ff5d0c2b2438e2ed4179fe3b3837d7ead 100644 (file)
@@ -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);
        }
     }
index 9aa6a8e854d3d4094f9e7f10a645d40bb8661375..40ee5467ac1645defa89f245b37105e6f3ea1c49 100644 (file)
@@ -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");
index bef20ce7cc2e11f2b2d52d1e1df630fde53e5962..5cf716ab5e6f9898a03e22d48f5c35ba21be6dcb 100644 (file)
@@ -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);
index 07c6077999c242962c511bb98db7298d122f324b..75d89c7f25542826785316e07bd1dfd1dae8b1e3 100644 (file)
@@ -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);
        }
     }
index f90ec5f43088bb3e89ea80e068ef4da71a2296f1..d93efa0ac94b8ca99ab7662a23293415fa577674 100644 (file)
@@ -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
index 2848d41cd632418dc480edb5ef314773ecf492b3..551ed5ccbe63a065ac65f479c7616b043a01e360 100644 (file)
@@ -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');
        }
     }