Update for YAZ 3s new OID system
[yazproxy-moved-to-github.git] / src / yaz-proxy-main.cpp
index 01209d3..84bd47c 100644 (file)
@@ -1,7 +1,7 @@
-/* $Id: yaz-proxy-main.cpp,v 1.16 2005-06-25 15:58:33 adam Exp $
-   Copyright (c) 1998-2005, Index Data.
+/* $Id: yaz-proxy-main.cpp,v 1.20 2006-07-06 11:50:26 adam Exp $
+   Copyright (c) 1998-2006, Index Data.
 
-This file is part of the yaz-proxy.
+This file is part of the yazproxy.
 
 YAZ proxy is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -45,11 +45,11 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <yaz/log.h>
 #include <yaz/options.h>
 
-#include <yaz++/socket-manager.h>
-#include <yaz++/pdu-assoc.h>
+#include <yazpp/socket-manager.h>
+#include <yazpp/pdu-assoc.h>
 #include <yazproxy/proxy.h>
 
-#if HAVE_XSLT
+#if YAZ_HAVE_XSLT
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <libxslt/xsltutils.h>
@@ -60,8 +60,10 @@ using namespace yazpp_1;
 
 void usage(char *prog)
 {
-    fprintf (stderr, "%s: [-c config] [-l log] [-a log] [-v level] [-t target] "
-             "[-u uid] [-p pidfile] @:port\n", prog);
+    fprintf (stderr, "%s: [-a log] [-c config]\n"
+             " [-i sec] [-l log] [-m num] [-n num] [-p pidfile]"
+             " [-t target] [-T sec] [-u uid]\n"
+             " [-v level] [-X] @:port\n", prog);
     exit (1);
 }
 
@@ -92,6 +94,9 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
             }
             addr = arg;
             break;
+        case 'a':
+            proxy->set_APDU_log(arg);
+            break;
         case 'c':
             err = proxy->set_config(arg);
             if (err == -2)
@@ -105,17 +110,8 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
                 exit(1);
             }
             break;
-        case 'a':
-            proxy->set_APDU_log(arg);
-            break;
-        case 't':
-            proxy->set_default_target(arg);
-            break;
-        case 'o':
-            proxy->option("optimize", arg);
-            break;
-        case 'v':
-            yaz_log_init_level (yaz_log_mask_str(arg));
+        case 'i':
+            proxy->set_client_idletime(atoi(arg));
             break;
         case 'l':
             yaz_log_init_file (arg);
@@ -124,27 +120,33 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
         case 'm':
             proxy->set_max_clients(atoi(arg));
             break;
-        case 'i':
-            proxy->set_client_idletime(atoi(arg));
-            break;
-        case 'T':
-            proxy->set_target_idletime(atoi(arg));
-            break;
         case 'n':
             no_limit_files = atoi(arg);
             break;
-        case 'X':
-            proxy->set_debug_mode(1);
-            debug = 1;
+        case 'o':
+            proxy->option("optimize", arg);
             break;
         case 'p':
             if (!pid_fname)
                 pid_fname = xstrdup(arg);
             break;
+        case 't':
+            proxy->set_default_target(arg);
+            break;
+        case 'T':
+            proxy->set_target_idletime(atoi(arg));
+            break;
         case 'u':
             if (!uid)
                 uid = xstrdup(arg);
             break;
+        case 'v':
+            yaz_log_init_level (yaz_log_mask_str(arg));
+            break;
+        case 'X':
+            proxy->set_debug_mode(1);
+            debug = 1;
+            break;
         default:
             usage(prog);
             return 1;
@@ -177,7 +179,7 @@ static void sighup_handler(int num)
         static_yaz_proxy->reconfig();
 }
 
-#if HAVE_XSLT
+#if YAZ_HAVE_XSLT
 static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
 {
     char buf[1024];
@@ -203,7 +205,7 @@ static void child_run(SocketManager *m, int run)
     signal(SIGHUP, sighup_handler);
 #endif
 
-#if HAVE_XSLT
+#if YAZ_HAVE_XSLT
     xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler);
     xsltSetGenericErrorFunc((void *) "XSLT", proxy_xml_error_handler);
 #endif
@@ -277,7 +279,7 @@ static void child_run(SocketManager *m, int run)
 
 int main(int argc, char **argv)
 {
-#if HAVE_XSLT
+#if YAZ_HAVE_XSLT
     xmlInitMemory();
     
     LIBXML_TEST_VERSION