counting ewrror corrected such that multiple repeats do work correctly
[yaz-moved-to-github.git] / zoom / zoomtst1.c
1 /*
2  * $Id: zoomtst1.c,v 1.4 2005-06-25 15:46:08 adam Exp $
3  *
4  * Synchronous single-target client doing search (but no retrieval)
5  */
6
7 #include <stdlib.h>
8 #include <stdio.h>
9 #include <yaz/xmalloc.h>
10 #include <yaz/zoom.h>
11
12 int main(int argc, char **argv)
13 {
14     ZOOM_connection z;
15     ZOOM_resultset r;
16     int error;
17     const char *errmsg, *addinfo;
18
19     if (argc != 3)
20     {
21         fprintf (stderr, "usage:\n%s target query\n", *argv);
22         fprintf (stderr, " eg.  bagel.indexdata.dk/gils computer\n");
23         exit (1);
24     }
25     z = ZOOM_connection_new (argv[1], 0);
26     
27     if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
28     {
29         fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
30         exit (2);
31     }
32
33     r = ZOOM_connection_search_pqf (z, argv[2]);
34     if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
35         fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
36     else
37         printf ("Result count: %d\n", ZOOM_resultset_size(r));
38     ZOOM_resultset_destroy (r);
39     ZOOM_connection_destroy (z);
40     exit (0);
41 }
42 /*
43  * Local variables:
44  * c-basic-offset: 4
45  * indent-tabs-mode: nil
46  * End:
47  * vim: shiftwidth=4 tabstop=8 expandtab
48  */
49