From 8c7689a9150ae2639201c726a010c9059055b9be Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 10 Sep 2007 08:42:48 +0000 Subject: [PATCH] Added option -V which shows version information. --- doc/pazpar2.xml | 14 +++++++++++++- src/pazpar2.c | 23 +++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/doc/pazpar2.xml b/doc/pazpar2.xml index a50c7a9..ae08fe8 100644 --- a/doc/pazpar2.xml +++ b/doc/pazpar2.xml @@ -8,7 +8,7 @@ %idcommon; ]> - + Pazpar2 @@ -35,6 +35,7 @@ + @@ -131,6 +132,17 @@ + + + + Shows Pazpar2 version and versions of some of the components that it + is using (ICU and YAZ). Pazpar2 will not exit immediately after + displaying the version information (no daemon started). + + + + + diff --git a/src/pazpar2.c b/src/pazpar2.c index bc87e4c..2f171b6 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -1,4 +1,4 @@ -/* $Id: pazpar2.c,v 1.92 2007-07-10 09:19:32 adam Exp $ +/* $Id: pazpar2.c,v 1.93 2007-09-10 08:42:48 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -50,6 +50,22 @@ void child_handler(void *data) } +static void show_version(void) +{ + char yaz_version_str[80]; + printf("Pazpar2 " VERSION "\n"); + + yaz_version(yaz_version_str, 0); + + printf("Configuration:"); +#if HAVE_ICU + printf(" icu:?"); +#endif + printf(" yaz:%s", yaz_version_str); + printf("\n"); + exit(0); +} + int main(int argc, char **argv) { int daemon = 0; @@ -64,7 +80,7 @@ int main(int argc, char **argv) yaz_log_init_prefix("pazpar2"); - while ((ret = options("dDf:h:l:p:t:u:X", argv, argc, &arg)) != -2) + while ((ret = options("dDf:h:l:p:t:u:VX", argv, argc, &arg)) != -2) { switch (ret) { @@ -94,6 +110,8 @@ int main(int argc, char **argv) case 'u': uid = arg; break; + case 'V': + show_version(); case 'X': global_parameters.debug_mode = 1; break; @@ -107,6 +125,7 @@ int main(int argc, char **argv) " -p pidfile PID file\n" " -t settings\n" " -u uid\n" + " -V show version\n" " -X debug mode\n" ); exit(1); -- 1.7.10.4