X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=zoom%2Fzoomtst2.c;h=f8e31596c3543d6844ed4a41d87729ff9530b365;hp=ed0b82f17cbee5739d5505ea13fe0818fd8defef;hb=d168db0590bc858a1bc9bd5a6ea66abbcd8f7d7d;hpb=69bcd68523a9a8da083faef16887100369152673 diff --git a/zoom/zoomtst2.c b/zoom/zoomtst2.c index ed0b82f..f8e3159 100644 --- a/zoom/zoomtst2.c +++ b/zoom/zoomtst2.c @@ -1,8 +1,8 @@ -/* - * $Id: zoomtst2.c,v 1.1 2001-10-23 21:00:20 adam Exp $ - * - * Asynchronous single-target client performing search (no retrieval) - */ +/* $Id: zoomtst2.c,v 1.8 2006-04-21 10:28:08 adam Exp $ */ + +/** \file zoomtst2.c + \brief Asynchronous single-target client performing search (no retrieval) +*/ #include #include @@ -11,44 +11,56 @@ int main(int argc, char **argv) { - Z3950_connection z; - Z3950_resultset r; + ZOOM_connection z; + ZOOM_resultset r; int error; - const char *errmsg, *addinfo; + const char *errmsg, *addinfo, *diagset; if (argc < 3) { - fprintf (stderr, "usage:\n%s target query\n", *argv); - fprintf (stderr, - "Verify: aasynchronous single-target client\n"); - exit (1); + fprintf (stderr, "usage:\n%s target query\n", *argv); + fprintf (stderr, + "Verify: asynchronous single-target client\n"); + exit (1); } /* create connection (don't connect yet) */ - z = Z3950_connection_create(0); + z = ZOOM_connection_create(0); + + /* option: set sru/get operation (only applicable if http: is used) */ + ZOOM_connection_option_set (z, "sru", "post"); /* option: set async operation */ - Z3950_connection_option (z, "async", "1"); + ZOOM_connection_option_set (z, "async", "1"); /* connect to target and initialize */ - Z3950_connection_connect (z, argv[1], 0); + ZOOM_connection_connect (z, argv[1], 0); /* search using prefix query format */ - r = Z3950_connection_search_pqf (z, argv[2]); + r = ZOOM_connection_search_pqf (z, argv[2]); /* block here: only one connection */ - while (Z3950_event (1, &z)) - ; + while (ZOOM_event (1, &z)) + ; /* see if any error occurred */ - if ((error = Z3950_connection_error(z, &errmsg, &addinfo))) + if ((error = ZOOM_connection_error_x(z, &errmsg, &addinfo, &diagset))) { - fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo); - exit (2); + fprintf (stderr, "Error: %s: %s (%d) %s\n", diagset, errmsg, error, + addinfo); + exit (2); } else /* OK print hit count */ - printf ("Result count: %d\n", Z3950_resultset_size(r)); - Z3950_resultset_destroy (r); - Z3950_connection_destroy (z); + printf ("Result count: %ld\n", (long) ZOOM_resultset_size(r)); + ZOOM_resultset_destroy (r); + ZOOM_connection_destroy (z); exit (0); } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +