/*
- * $Id: zoomtst5.c,v 1.2 2001-10-24 12:24:43 adam Exp $
+ * $Id: zoomtst5.c,v 1.5 2001-11-16 09:52:39 adam Exp $
*
* Asynchronous multi-target client doing search, sort and present
*/
int no = argc-3;
Z3950_connection z[500]; /* allow at most 500 connections */
Z3950_resultset r[500]; /* and result sets .. */
- Z3950_search s;
+ Z3950_query q;
Z3950_options o;
o = Z3950_options_create ();
Z3950_options_set (o, "elementSetName", "B");
/* create query */
- s = Z3950_search_create ();
- if (Z3950_search_prefix (s, argv[argc-2]))
+ q = Z3950_query_create ();
+ if (Z3950_query_prefix (q, argv[argc-2]))
{
printf ("bad PQF: %s\n", argv[argc-2]);
exit (1);
}
- if (Z3950_search_sortby (s, argv[argc-1]))
+ if (Z3950_query_sortby (q, argv[argc-1]))
{
printf ("bad sort spec: %s\n", argv[argc-1]);
exit (1);
{
z[i] = Z3950_connection_create (o);
Z3950_connection_connect (z[i], argv[i+1], 0);
- r[i] = Z3950_connection_search (z[i], s);
+ r[i] = Z3950_connection_search (z[i], q);
}
/* network I/O */
const char *errmsg, *addinfo;
if ((error = Z3950_connection_error(z[i], &errmsg, &addinfo)))
fprintf (stderr, "%s error: %s (%d) %s\n",
- Z3950_connection_host(z[i]),
+ Z3950_connection_option_get(z[i], "host"),
errmsg, error, addinfo);
else
{
/* OK, no major errors. Look at the result count */
int pos;
- printf ("%s: %d hits\n", Z3950_connection_host(z[i]),
+ printf ("%s: %d hits\n", Z3950_connection_option_get(z[i], "host"),
Z3950_resultset_size(r[i]));
/* go through all records at target */
for (pos = 0; pos < 20; pos++)
fwrite (str, 1, len, stdout);
putchar ('\n');
}
- Z3950_record_destroy (rec);
}
}
}
/* destroy stuff and exit */
- Z3950_search_destroy (s);
+ Z3950_query_destroy (q);
for (i = 0; i<no; i++)
{
Z3950_resultset_destroy (r[i]);
Z3950_connection_destroy (z[i]);
}
Z3950_options_destroy(o);
+ exit(0);
}