Update for YAZ 3s libyaz_server.la
[idzebra-moved-to-github.git] / index / zebraidx.c
index d07d76f..fd6d26a 100644 (file)
@@ -1,5 +1,5 @@
-/* $Id: zebraidx.c,v 1.1 2006-09-22 10:18:08 adam Exp $
-   Copyright (C) 1995-2006
+/* $Id: zebraidx.c,v 1.5 2007-04-17 20:27:14 adam Exp $
+   Copyright (C) 1995-2007
    Index Data ApS
 
 This file is part of the Zebra server.
@@ -30,13 +30,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <time.h>
-#if HAVE_SYS_TIMES_H
-#include <sys/times.h>
-#endif
 
 #include <yaz/log.h>
 #include <yaz/options.h>
@@ -64,34 +57,20 @@ int main (int argc, char **argv)
     int enable_commit = 1;
     char *database = 0;
     Res res = res_open(0, 0);
+    Res default_res = res_open(0, 0);
     
-    int trans_started=0;
-#if HAVE_SYS_TIMES_H
-    struct tms tms1, tms2;
-    double usec;
-#endif
-#if HAVE_SYS_TIME_H
-    struct timeval start_time, end_time;
-#endif
+    int trans_started = 0;
 #ifndef WIN32
     char nbuf[100];
 #endif
     ZebraService zs = 0;
     ZebraHandle zh = 0;
 
-    nmem_init ();
-
 #ifdef WIN32
 #else
     sprintf(nbuf, "%.40s(%ld)", *argv, (long) getpid());
     yaz_log_init_prefix (nbuf);
 #endif
-#if HAVE_SYS_TIMES_H
-    times(&tms1);
-#endif
-#if HAVE_SYS_TIME_H
-    gettimeofday(&start_time, 0);
-#endif
     prog = *argv;
     if (argc < 2)
     {
@@ -120,6 +99,8 @@ int main (int argc, char **argv)
                  );
         exit (1);
     }
+    res_set(default_res, "profilePath", DEFAULT_PROFILE_PATH);
+    res_set(default_res, "modulePath", DEFAULT_MODULE_PATH);
     while ((ret = options("sVt:c:g:d:m:v:nf:l:L", argv, argc, &arg)) != -2)
     {
         if (ret == 0)
@@ -129,7 +110,7 @@ int main (int argc, char **argv)
                 if (!zs)
                 {
                    const char *config = configName ? configName : "zebra.cfg";
-                    zs = zebra_start_res (config, 0, res);
+                    zs = zebra_start_res(config, default_res, res);
                     if (!zs)
                     {
                        yaz_log (YLOG_FATAL, "Cannot read config %s", config);
@@ -250,7 +231,7 @@ int main (int argc, char **argv)
         else if (ret == 'V')
         {
             printf("Zebra %s %s\n", ZEBRAVER, ZEBRADATE);
-           printf(" (C) 1994-2006, Index Data ApS\n");
+           printf(" (C) 1994-2007, Index Data ApS\n");
 #ifdef WIN32
 #ifdef _DEBUG
             printf(" WIN32 Debug\n");
@@ -294,22 +275,9 @@ int main (int argc, char **argv)
 
     zebra_close (zh);
     zebra_stop (zs);
-#if HAVE_SYS_TIMES_H
-#if HAVE_SYS_TIME_H
-    if (trans_started)
-    {
-        gettimeofday(&end_time, 0);
-        usec = (end_time.tv_sec - start_time.tv_sec) * 1000000.0 +
-           end_time.tv_usec - start_time.tv_usec;
-        times(&tms2);
-        yaz_log (YLOG_LOG, "zebraidx times: %5.2f %5.2f %5.2f",
-               usec / 1000000,
-               (double) (tms2.tms_utime - tms1.tms_utime)/100,
-               (double) (tms2.tms_stime - tms1.tms_stime)/100);
-    }
-#endif
-#endif
-    nmem_exit();
+
+    res_close(res);
+    res_close(default_res);
     exit (0);
     return 0;
 }