Bump year. Change Aps->ApS
[idzebra-moved-to-github.git] / test / api / t6.c
index 35a2cde..0942d71 100644 (file)
@@ -1,6 +1,6 @@
-/* $Id: t6.c,v 1.3 2004-08-25 09:23:39 adam Exp $
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
-   Index Data Aps
+/* $Id: t6.c,v 1.7 2005-01-15 19:38:35 adam Exp $
+   Copyright (C) 1995-2005
+   Index Data ApS
 
 This file is part of the Zebra server.
 
@@ -20,35 +20,18 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.
 */
 
-#include <stdlib.h>
+/** t6.c Insert a number of randomly generated words */
 
-#include <yaz/log.h>
-#include <yaz/pquery.h>
-#include <idzebra/api.h>
+#include "testlib.h"
 
-/* read zebra.cfg from env var srcdir if it exists; otherwise current dir */
-static ZebraService start_service()
-{
-    char cfg[256];
-    char *srcdir = getenv("srcdir");
-    sprintf(cfg, "%.200s%szebra6.cfg", srcdir ? srcdir : "", srcdir ? "/" : "");
-    return zebra_start(cfg);
-}
-       
 int main(int argc, char **argv)
 {
     int i;
-    ZebraService zs;
-    ZebraHandle zh;
+    ZebraService zs = start_up(0, argc, argv);
+    ZebraHandle zh = zebra_open(zs);
 
-    yaz_log_init_file("t6.log");
-
-    nmem_init ();
-    
     srand(17);
     
-    zs = start_service();
-    zh = zebra_open(zs);
     zebra_select_database(zh, "Default");
     zebra_init(zh);
     zebra_close(zh);
@@ -77,12 +60,9 @@ int main(int argc, char **argv)
        strcat(rec_buf, "</Control-Identifier></gils>");
        zebra_add_record (zh, rec_buf, strlen(rec_buf));
 
-       zebra_end_trans (zh);
+       zebra_end_trans(zh);
        zebra_close(zh);
     }
-    zebra_stop(zs);
 
-    nmem_exit ();
-    xmalloc_trav ("x");
-    exit (0);
+    return close_down(0 /*zh*/, zs, 0);
 }