Zebra links with ICU enabled YAZ. Requires YAZ 3.0.15 or later.
[idzebra-moved-to-github.git] / index / zebraidx.c
index 4fe0448..6aa13e0 100644 (file)
@@ -1,5 +1,5 @@
-/* $Id: zebraidx.c,v 1.2 2006-12-05 09:26:37 adam Exp $
-   Copyright (C) 1995-2006
+/* $Id: zebraidx.c,v 1.7 2007-10-22 13:05:22 adam Exp $
+   Copyright (C) 1995-2007
    Index Data ApS
 
 This file is part of the Zebra server.
@@ -30,16 +30,11 @@ 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/icu_I18N.h>
 #include <yaz/log.h>
 #include <yaz/options.h>
+#include <idzebra/version.h>
 #include <idzebra/api.h>
 
 char *prog;
@@ -66,33 +61,18 @@ int main (int argc, char **argv)
     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)
     {
@@ -252,17 +232,19 @@ 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");
-#ifdef WIN32
-#ifdef _DEBUG
-            printf(" WIN32 Debug\n");
-#else
-            printf(" WIN32 Release\n");
-#endif
-#endif
-#if HAVE_BZLIB_H
-            printf("Using: libbzip2, (C) 1996-1999 Julian R Seward.  All rights reserved.\n");
+            char version_str[20];
+            char sys_str[80];
+            zebra_get_version(version_str, sys_str);
+
+            printf("Zebra %s\n", version_str);
+           printf("(C) 1994-2007, Index Data ApS\n");
+            printf("Zebra is free software, covered by the GNU General Public License, and you are\n");
+            printf("welcome to change it and/or distribute copies of it under certain conditions.\n");
+            printf("Configured as: %s\n", sys_str);
+            if (strcmp(version_str, ZEBRAVER))
+                printf("zebraidx compiled version %s\n", ZEBRAVER);
+#if HAVE_ICU
+            printf("Using ICU\n");
 #endif
         }
         else if (ret == 'v')
@@ -297,24 +279,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
+
     res_close(res);
     res_close(default_res);
-    nmem_exit();
     exit (0);
     return 0;
 }