X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fapi%2Ft4.c;h=cb56b2ad464971ed554cd09a857b1e6aec3e8253;hb=ec214819d7b9e2f5c362584d8e38f83e13aae600;hp=59331b8393b683713483c91ba3aac6d8a4b680de;hpb=ae2d0647bd3a555df77397b6c2f9c129fda0733a;p=idzebra-moved-to-github.git diff --git a/test/api/t4.c b/test/api/t4.c index 59331b8..cb56b2a 100644 --- a/test/api/t4.c +++ b/test/api/t4.c @@ -1,5 +1,5 @@ -/* $Id: t4.c,v 1.3 2003-06-23 15:36:12 adam Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 +/* $Id: t4.c,v 1.9 2004-08-25 09:23:39 adam Exp $ + Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps This file is part of the Zebra server. @@ -22,8 +22,17 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include +/* 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%szebra.cfg", srcdir ? srcdir : "", srcdir ? "/" : ""); + return zebra_start(cfg); +} + int main(int argc, char **argv) { int i; @@ -34,22 +43,23 @@ int main(int argc, char **argv) " My title\n" "\n"; - yaz_log_init_file("t3.log"); + yaz_log_init_file("t4.log"); nmem_init (); - zs = zebra_start("t2.cfg"); + zs = start_service(); zh = zebra_open (zs); + zebra_init(zh); zebra_select_database(zh, "Default"); zebra_begin_trans (zh, 1); for (i = 0; i<1200; i++) - zebra_record_insert (zh, myrec, strlen(myrec),0); + zebra_add_record (zh, myrec, strlen(myrec)); zebra_end_trans (zh); zebra_close(zh); zebra_stop(zs); - zs = zebra_start("t2.cfg"); + zs = start_service(); zh = zebra_open (zs); zebra_select_database(zh, "Default");