1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2009 Index Data
3 * See the file LICENSE for details.
11 int main(int argc, char **argv)
16 const char *errmsg, *addinfo, *diagset;
20 fprintf (stderr, "usage:\n%s target query\n", *argv);
22 "Verify: asynchronous single-target client\n");
26 /* create connection (don't connect yet) */
27 z = ZOOM_connection_create(0);
29 /* option: set sru/get operation (only applicable if http: is used) */
30 ZOOM_connection_option_set (z, "sru", "post");
32 /* option: set async operation */
33 ZOOM_connection_option_set (z, "async", "1");
35 /* connect to target and initialize */
36 ZOOM_connection_connect (z, argv[1], 0);
38 /* search using prefix query format */
39 r = ZOOM_connection_search_pqf (z, argv[2]);
41 /* block here: only one connection */
42 while (ZOOM_event (1, &z))
45 /* see if any error occurred */
46 if ((error = ZOOM_connection_error_x(z, &errmsg, &addinfo, &diagset)))
48 fprintf (stderr, "Error: %s: %s (%d) %s\n", diagset, errmsg, error,
52 else /* OK print hit count */
53 printf ("Result count: %ld\n", (long) ZOOM_resultset_size(r));
54 ZOOM_resultset_destroy (r);
55 ZOOM_connection_destroy (z);
61 * indent-tabs-mode: nil
63 * vim: shiftwidth=4 tabstop=8 expandtab