[shibboleth-sp2] 96/119: Add -v option to print version.

Ferenc Wágner wferi-guest at moszumanska.debian.org
Tue Jan 26 21:29:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

wferi-guest pushed a commit to annotated tag 1.3.1
in repository shibboleth-sp2.

commit 0d8ee42d1d4867b5261785ac90ccdc562e2bf671
Author: Scott Cantor <cantor.2 at osu.edu>
Date:   Wed Oct 24 21:28:32 2007 +0000

    Add -v option to print version.
---
 shar/shar.cpp | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/shar/shar.cpp b/shar/shar.cpp
index 6248c1e..2b1947e 100644
--- a/shar/shar.cpp
+++ b/shar/shar.cpp
@@ -59,6 +59,7 @@ int shar_run = 1;
 const char* shar_config = NULL;
 const char* shar_schemadir = NULL;
 bool shar_checkonly = false;
+bool shar_version = false;
 static int unlink_socket = 0;
 const char* pidfile = NULL;
 
@@ -298,6 +299,7 @@ static void usage(char* whoami)
     fprintf(stderr, "  -t\tcheck configuration file for problems.\n");
     fprintf(stderr, "  -f\tforce removal of listener socket.\n");
     fprintf(stderr, "  -p\tpid file to use.\n");
+    fprintf(stderr, "  -v\tprint software version.\n");
     fprintf(stderr, "  -h\tprint this help message.\n");
     exit(1);
 }
@@ -306,7 +308,7 @@ static int parse_args(int argc, char* argv[])
 {
     int opt;
 
-    while ((opt = getopt(argc, argv, "c:d:p:fth")) > 0) {
+    while ((opt = getopt(argc, argv, "c:d:p:ftvh")) > 0) {
         switch (opt) {
             case 'c':
                 shar_config=optarg;
@@ -320,6 +322,9 @@ static int parse_args(int argc, char* argv[])
             case 't':
                 shar_checkonly=true;
                 break;
+            case 'v':
+                shar_version=true;
+                break;
             case 'p':
                 pidfile=optarg;
                 break;
@@ -337,11 +342,15 @@ int main(int argc, char *argv[])
         { SHIBRPC_PROG, SHIBRPC_VERS_2, shibrpc_prog_2 }
     };
 
-    if (setup_signals() != 0)
-        return -1;
-
     if (parse_args(argc, argv) != 0)
         usage(argv[0]);
+    else if (shar_version) {
+        fprintf(stdout, PACKAGE_STRING);
+        return 0;
+    }
+
+    if (setup_signals() != 0)
+        return -1;
 
     if (!shar_config)
         shar_config=getenv("SHIBCONFIG");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/shibboleth-sp2.git



More information about the Pkg-shibboleth-devel mailing list