From e868e46c150fd38e72a1d087ce5306bb7c715847 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 22 Oct 2002 10:47:48 +0000 Subject: [PATCH] Added testclient using ZOOM C from YAZ --- test/Makefile.am | 8 ++++++++ test/testclient.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 test/testclient.c diff --git a/test/Makefile.am b/test/Makefile.am index facee4d..a4c24e8 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,2 +1,10 @@ SUBDIRS=gils usmarc api dmoz + +testclient_SOURCES = testclient.c + +noinst_PROGRAMS = testclient + +AM_CPPFLAGS = $(YAZINC) + +LDADD = $(YAZLIB) diff --git a/test/testclient.c b/test/testclient.c new file mode 100644 index 0000000..0afa914 --- /dev/null +++ b/test/testclient.c @@ -0,0 +1,41 @@ +/* + * $Id: testclient.c,v 1.1 2002-10-22 10:47:48 adam Exp $ + * + * Synchronous single-target client doing search (but no yet retrieval) + */ + +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + ZOOM_connection z; + ZOOM_resultset r; + int error; + const char *errmsg, *addinfo; + + if (argc != 3) + { + fprintf (stderr, "usage:\n%s target query\n", *argv); + fprintf (stderr, " eg. bagel.indexdata.dk/gils computer\n"); + exit (1); + } + z = ZOOM_connection_new (argv[1], 0); + + if ((error = ZOOM_connection_error(z, &errmsg, &addinfo))) + { + fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo); + exit (2); + } + + r = ZOOM_connection_search_pqf (z, argv[2]); + if ((error = ZOOM_connection_error(z, &errmsg, &addinfo))) + fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo); + else + printf ("Result count: %d\n", ZOOM_resultset_size(r)); + ZOOM_resultset_destroy (r); + ZOOM_connection_destroy (z); + exit (0); +} -- 1.7.10.4