X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=zoom%2Fzoomtst11.c;h=89cea5ad9c9203da2e9ea4e8dcf47c84bf82f2bb;hp=a3ce111c79c77c4d20373ee2d448283037e64d27;hb=d84e4c3cd444d04aee7beeadb5bb0ae061ee24c9;hpb=6ae9b6acff7b96dda296313b8c0e24c1626afdd8 diff --git a/zoom/zoomtst11.c b/zoom/zoomtst11.c index a3ce111..89cea5a 100644 --- a/zoom/zoomtst11.c +++ b/zoom/zoomtst11.c @@ -1,8 +1,7 @@ -/* $Id: zoomtst11.c,v 1.1 2007-02-21 09:10:19 adam Exp $ */ - -/** \file zoomtst11.c - \brief Asynchronous single-target which tests event/error handling -*/ +/* This file is part of the YAZ toolkit. + * Copyright (C) Index Data + * See the file LICENSE for details. + */ #include #include @@ -73,30 +72,31 @@ int main(int argc, char **argv) while (ZOOM_event (1, &z)) { int ev = ZOOM_connection_last_event(z); - if (ev == ZOOM_EVENT_RECV_SEARCH) + int idle = ZOOM_connection_is_idle(z); + + /* see if any error occurred */ + if ((error = ZOOM_connection_error_x(z, &errmsg, &addinfo, &diagset))) { - int idle = ZOOM_connection_is_idle(z); - /* see if any error occurred */ - if ((error = ZOOM_connection_error_x(z, &errmsg, &addinfo, &diagset))) - { - fprintf (stderr, "Error: %s: %s (%d) %s\n", diagset, errmsg, error, - addinfo); + fprintf (stderr, "Error: %s: %s (%d) %s\n", diagset, errmsg, error, + addinfo); - } - else /* OK print hit count */ + } + if (ev == ZOOM_EVENT_RECV_SEARCH) + { + if (error == 0) printf ("Search OK\n"); printf("idle=%d\n", idle); - if (idle) + } + if (idle) + { + ZOOM_connection_connect(z, 0, 0); /* allow reconnect */ + + if (++use <= 10) { - ZOOM_connection_connect(z, 0, 0); /* allow reconnect */ - - if (++use <= 10) - { - probe_search(z, use, use&1); - } - printf("Press enter\n"); - getchar(); + probe_search(z, use, use&1); } + printf("Press enter\n"); + getchar(); } } ZOOM_connection_destroy (z); @@ -105,6 +105,7 @@ int main(int argc, char **argv) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab