X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=zoom%2Fzoomtst7.c;h=6c3aa6b4f636d16676c8d1d550d97b9862940071;hb=49218d3cab22778f7460f1099d0534e057be629f;hp=0c5a659f9873a64fbf06342dedf89106225cf0b0;hpb=bc66c2a11aa31c16f46c49100e99dc9b7e940faf;p=yaz-moved-to-github.git diff --git a/zoom/zoomtst7.c b/zoom/zoomtst7.c index 0c5a659..6c3aa6b 100644 --- a/zoom/zoomtst7.c +++ b/zoom/zoomtst7.c @@ -1,5 +1,5 @@ /* - * $Id: zoomtst7.c,v 1.2 2001-10-24 12:24:43 adam Exp $ + * $Id: zoomtst7.c,v 1.4 2001-11-11 22:25:25 adam Exp $ * * API test.. */ @@ -22,6 +22,15 @@ int main(int argc, char **argv) o = Z3950_options_create (); + z = Z3950_connection_new ("localhost", 9999); + if (Z3950_connection_error (z, 0, 0)) + { + printf ("error - couldn't connect?\n"); + exit (1); + } + + Z3950_connection_destroy (z); + for (block = 0; block < 3; block++) { switch (block) @@ -51,11 +60,11 @@ int main(int argc, char **argv) Z3950_record recs[2]; size_t recs_count = 2; char query[40]; - Z3950_search s = Z3950_search_create (); + Z3950_query s = Z3950_query_create (); sprintf (query, "i%dr%d", i, j); - if (Z3950_search_prefix (s, query)) + if (Z3950_query_prefix (s, query)) { printf ("bad PQF: %s\n", query); exit (2); @@ -65,13 +74,10 @@ int main(int argc, char **argv) r[j] = Z3950_connection_search (z, s); /* non-piggy */ - Z3950_options_set (o, "count", "2"); - Z3950_resultset_records (r[j], 0, 0); /* first two */ + Z3950_resultset_records (r[j], recs, 0, 2); /* first two */ - Z3950_options_set (o, "start", "1"); - Z3950_options_set (o, "count", "2"); - Z3950_resultset_records (r[j], recs, &recs_count); /* third */ - Z3950_resultset_records (r[j], 0, 0); /* ignored */ + Z3950_resultset_records (r[j], recs, 1, 2); /* third */ + Z3950_resultset_records (r[j], recs, 0, 0); /* ignored */ if (Z3950_resultset_size (r[j]) > 2) { @@ -84,7 +90,7 @@ int main(int argc, char **argv) Z3950_record_destroy (recs[0]); Z3950_record_destroy (recs[1]); - Z3950_search_destroy (s); + Z3950_query_destroy (s); putchar ('.'); if (block > 0) @@ -101,7 +107,7 @@ int main(int argc, char **argv) for (i = 0; i<1; i++) { - Z3950_search s = Z3950_search_create (); + Z3950_query q = Z3950_query_create (); char host[40]; printf ("session %2d", i+10); @@ -126,17 +132,16 @@ int main(int argc, char **argv) } Z3950_connection_destroy (z); - Z3950_options_set (o, "count", "1"); for (j = 0; j < 10; j++) { - Z3950_resultset_records (r[j], 0, 0); + Z3950_resultset_records (r[j], 0, 0, 1); if (block > 0) while (Z3950_event (1, &z)) ; } for (j = 0; j < 10; j++) Z3950_resultset_destroy (r[j]); - Z3950_search_destroy (s); + Z3950_query_destroy (q); printf ("10 searches, 10 ignored presents done\n"); } }