Tokenize for index_type system.
[idzebra-moved-to-github.git] / index / zebrasrv.c
index 25f2d27..9629d41 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebrasrv.c,v 1.16 2007-05-21 11:54:59 adam Exp $
+/* $Id: zebrasrv.c,v 1.20 2007-10-25 07:43:13 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -61,6 +61,7 @@ bend_initresult *bend_init (bend_initrequest *q)
     struct statserv_options_block *sob;
     char *user = NULL;
     char *passwd = NULL;
+    char version_str[16];
 
     r->errcode = 0;
     r->errstring = 0;
@@ -72,8 +73,10 @@ bend_initresult *bend_init (bend_initrequest *q)
     q->bend_fetch = bend_fetch;
     q->bend_scan = bend_scan;
 
+    zebra_get_version(version_str, 0);
+
     q->implementation_name = "Zebra Information Server";
-    q->implementation_version = "Zebra " ZEBRAVER;
+    q->implementation_version = odr_strdup(q->stream, version_str);
 
     yaz_log (YLOG_DEBUG, "bend_init");
 
@@ -367,8 +370,6 @@ static int bend_scan (void *handle, bend_scan_rr *r)
        r->errstring = 0;
         return 0;
     }
-    r->entries = (struct scan_entry *)
-       odr_malloc (r->stream, sizeof(*r->entries) * r->num_entries);
     res = zebra_scan(zh, r->stream, r->term,
                     r->attributeset,
                     &r->term_position,
@@ -383,6 +384,7 @@ static int bend_scan (void *handle, bend_scan_rr *r)
        for (i = 0; i < r->num_entries; i++)
        {
            r->entries[i].term = entries[i].term;
+           r->entries[i].display_term = entries[i].display_term;
            r->entries[i].occurrences =
                 CAST_ZINT_TO_INT(entries[i].occurrences);
        }
@@ -735,7 +737,7 @@ static void bend_start (struct statserv_options_block *sob)
 #ifdef WIN32
     
 #else
-    if (!sob->inetd) 
+    if (!sob->inetd && !sob->background) 
     {
        char pidfname[4096];
         struct flock area;
@@ -782,7 +784,7 @@ static void bend_stop(struct statserv_options_block *sob)
 #ifdef WIN32
 
 #else
-    if (!sob->inetd && sob->handle) 
+    if (!sob->inetd && !sob->background && sob->handle) 
     {
        char pidfname[4096];
        zebra_pidfname(sob->handle, pidfname);