yaz-ztest: -V shows version (like yaz-client -V)
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 13 Nov 2013 12:23:21 +0000 (13:23 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 13 Nov 2013 12:23:21 +0000 (13:23 +0100)
doc/gfs-options.xml
doc/gfs-synopsis.xml
src/statserv.c

index 39bc66f..af2f56b 100644 (file)
    </para></listitem>
  </varlistentry>
 
+ <varlistentry><term><literal>-V </literal></term>
+  <listitem><para>
+   Display YAZ version and exit.
+   </para></listitem>
+ </varlistentry>
+
 </variablelist>
 
 <!-- Keep this comment at the end of the file
index c868251..492b4dd 100644 (file)
@@ -22,7 +22,7 @@
  <arg choice="opt"><option>-w <replaceable>dir</replaceable></option></arg>
  <arg choice="opt"><option>-p <replaceable>pidfile</replaceable></option></arg>
  <arg choice="opt"><option>-r <replaceable>kilobytes</replaceable></option></arg>
- <arg choice="opt"><option>-ziDST1</option></arg>
+ <arg choice="opt"><option>-ziDSTV1</option></arg>
  <arg choice="opt" rep="repeat">listener-spec</arg>
 </cmdsynopsis>
 
index 5388730..fba26a1 100644 (file)
@@ -1259,6 +1259,17 @@ static void normal_stop_handler(int num)
 }
 #endif
 
+static void show_version(void)
+{
+    char vstr[20], sha1_str[41];
+
+    yaz_version(vstr, sha1_str);
+    printf("YAZ version: %s %s\n", YAZ_VERSION, YAZ_VERSION_SHA1);
+    if (strcmp(sha1_str, YAZ_VERSION_SHA1))
+        printf("YAZ DLL/SO: %s %s\n", vstr, sha1_str);
+    exit(0);
+}
+
 static int statserv_sc_main(yaz_sc_t s, int argc, char **argv)
 {
     char sep;
@@ -1338,7 +1349,7 @@ int check_options(int argc, char **argv)
 
     get_logbits(1);
 
-    while ((ret = options("1a:iszSTl:v:u:c:w:t:k:Kd:A:p:DC:f:m:r:",
+    while ((ret = options("1a:iszSTl:v:u:c:w:t:k:Kd:A:p:DC:f:m:r:V",
                           argv, argc, &arg)) != -2)
     {
         switch (ret)
@@ -1454,11 +1465,14 @@ int check_options(int argc, char **argv)
             }
             yaz_log_init_max_size(r * 1024);
             break;
+        case 'V':
+            show_version();
+            break;
         default:
             fprintf(stderr, "Usage: %s [ -a <pdufile> -v <loglevel>"
                     " -l <logfile> -u <user> -c <config> -t <minutes>"
                     " -k <kilobytes> -d <daemon> -p <pidfile> -C certfile"
-                    " -zKiDST1 -m <time-format> -w <directory> <listener-addr>... ]\n", me);
+                    " -zKiDSTV1 -m <time-format> -w <directory> <listener-addr>... ]\n", me);
             return 1;
         }
     }