X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fapi%2Ft3.c;h=864cad316e52aa06a2f39ec40e75ef982af3eed4;hb=2fefff35eeb40ba802bb3ee11674a6037b84659c;hp=240a1d7eefe3616f99bfb94f1ebe04e9684e2094;hpb=39d323b0aabcc0f1a08f37c3fa45fb187c7570ac;p=idzebra-moved-to-github.git diff --git a/test/api/t3.c b/test/api/t3.c index 240a1d7..864cad3 100644 --- a/test/api/t3.c +++ b/test/api/t3.c @@ -1,5 +1,5 @@ -/* $Id: t3.c,v 1.2 2003-05-20 13:52:41 adam Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 +/* $Id: t3.c,v 1.10 2004-10-15 10:07:34 heikki 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; @@ -35,15 +44,17 @@ int main(int argc, char **argv) "\n"; yaz_log_init_file("t3.log"); + yaz_log_init_level(LOG_ALL); nmem_init (); - zs = zebra_start("t2.cfg"); + zs = start_service(); zh = zebra_open (zs); zebra_select_database(zh, "Default"); + zebra_init(zh); zebra_begin_trans (zh, 1); - zebra_record_insert (zh, myrec, strlen(myrec)); + zebra_add_record (zh, myrec, strlen(myrec)); zebra_end_trans (zh); for (i = 0; i<4; i++) @@ -64,7 +75,7 @@ int main(int argc, char **argv) zebra_begin_trans (zh, 0); sprintf(setname, "s%d", i+1); - zebra_search_RPN (zh, query, setname, &hits); + zebra_search_RPN (zh, odr_input, query, setname, &hits); zebra_end_trans (zh); zebra_end_trans (zh);