Use yaz_log to print info about events; not printf
[yaz-moved-to-github.git] / zoom / zoomtst3.c
index ba07960..769df73 100644 (file)
@@ -1,10 +1,7 @@
-/* $Id: zoomtst3.c,v 1.11 2006-04-21 10:28:08 adam Exp $  */
-
-/** \file zoomtst3.c
-    \brief Asynchronous multi-target client
-    
-    Performs search and piggyback retrieval of records
-*/
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2010 Index Data
+ * See the file LICENSE for details.
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -68,8 +65,12 @@ int main(int argc, char **argv)
     /* network I/O. pass number of connections and array of connections */
     while ((i = ZOOM_event (no, z)))
     {
-        printf ("no = %d event = %d\n", i-1,
-                ZOOM_connection_last_event(z[i-1]));
+        int peek = ZOOM_connection_peek_event(z[i-1]);
+       int event = ZOOM_connection_last_event(z[i-1]);
+        printf ("no = %d peek = %d event = %d %s\n", i-1,
+                peek,
+               event,
+               ZOOM_get_event_str(event));
     }
     
     /* no more to be done. Inspect results */
@@ -96,12 +97,7 @@ int main(int argc, char **argv)
                         ZOOM_resultset_record (r[i], pos), "render", &len);
                 /* if rec is non-null, we got a record for display */
                 if (rec)
-                {
-                    printf ("%d\n", pos+1);
-                    if (rec)
-                        fwrite (rec, 1, len, stdout);
-                    printf ("\n");
-                }
+                    printf ("%d\n%.*s\n", pos+1, len, rec);
             }
         }
     }
@@ -117,6 +113,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