Added function yaz_log_xml_errors.
[yaz-moved-to-github.git] / src / statserv.c
index 7d108d7..63a5efb 100644 (file)
@@ -5,7 +5,7 @@
  * NT threaded server code by
  *   Chas Woodfield, Fretwell Downing Informatics.
  *
- * $Id: statserv.c,v 1.49 2007-05-06 20:12:20 adam Exp $
+ * $Id: statserv.c,v 1.52 2007-11-12 08:57:45 adam Exp $
  */
 
 /**
@@ -219,6 +219,7 @@ static struct gfs_server * gfs_server_new(void)
     n->host = 0;
     n->listen_ref = 0;
     n->cql_transform = 0;
+    n->ccl_transform = 0;
     n->server_node_ptr = 0;
     n->directory = 0;
     n->docpath = 0;
@@ -416,6 +417,20 @@ static void xml_config_read(void)
                         nmem_dup_xml_content(gfs_nmem, ptr->children)
                         );
                 }
+                else if (!strcmp((const char *) ptr->name, "ccl2rpn"))
+                {
+                    char *name;
+                    FILE *f;
+
+                    name = nmem_dup_xml_content(gfs_nmem, ptr->children);
+                    if ((f = fopen(name, "r")) == 0) {
+                        yaz_log(YLOG_FATAL, "can't open CCL file '%s'", name);
+                        exit(1);
+                    }
+                    gfs->ccl_transform = ccl_qual_mk();
+                    ccl_qual_file (gfs->ccl_transform, f);
+                    fclose(f);
+                }
                 else if (!strcmp((const char *) ptr->name, "directory"))
                 {
                     gfs->directory = 
@@ -756,7 +771,7 @@ void statserv_closedown()
 
 void __cdecl event_loop_thread (IOCHAN iochan)
 {
-    event_loop (&iochan);
+    iochan_event_loop (&iochan);
 }
 
 /* WIN32 listener */
@@ -1028,7 +1043,7 @@ static void *new_session (void *vp)
         control_block.one_shot = 1;
     if (control_block.threads)
     {
-        event_loop(&new_chan);
+        iochan_event_loop(&new_chan);
     }
     else
     {
@@ -1328,7 +1343,7 @@ int statserv_start(int argc, char **argv)
     if (pListener == NULL)
         return 1;
     yaz_log(YLOG_DEBUG, "Entering event loop.");
-    return event_loop(&pListener);
+    return iochan_event_loop(&pListener);
 }
 
 static void option_copy(char *dst, const char *src)
@@ -1343,6 +1358,8 @@ int check_options(int argc, char **argv)
     char *arg;
 
     yaz_log_init_level(yaz_log_mask_str(STAT_DEFAULT_LOG_LEVEL)); 
+
+    yaz_log_xml_errors(0, YLOG_WARN);
     get_logbits(1); 
 
     while ((ret = options("1a:iszSTl:v:u:c:w:t:k:d:A:p:DC:f:m:r:",