Use term Windows rather than win32
[yaz-moved-to-github.git] / zoom / zoomtst1.c
index 08c6bb8..067803d 100644 (file)
@@ -1,18 +1,17 @@
-/*
- * $Id: zoomtst1.c,v 1.1 2001-10-23 21:00:20 adam Exp $
- *
- * Synchronous single-target client doing search (but no retrieval)
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) Index Data
+ * See the file LICENSE for details.
  */
 
 #include <stdlib.h>
 #include <stdio.h>
-
+#include <yaz/xmalloc.h>
 #include <yaz/zoom.h>
 
 int main(int argc, char **argv)
 {
-    Z3950_connection z;
-    Z3950_resultset r;
+    ZOOM_connection z;
+    ZOOM_resultset r;
     int error;
     const char *errmsg, *addinfo;
 
@@ -22,20 +21,32 @@ int main(int argc, char **argv)
         fprintf (stderr, " eg.  bagel.indexdata.dk/gils computer\n");
         exit (1);
     }
-    z = Z3950_connection_new (argv[1], 0);
-    
-    if ((error = Z3950_connection_error(z, &errmsg, &addinfo)))
+    z = ZOOM_connection_new (argv[1], 0);
+
+    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
     {
-       fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
-       exit (2);
+        fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
+        exit (2);
     }
 
-    r = Z3950_connection_search_pqf (z, argv[2]);
-    if ((error = Z3950_connection_error(z, &errmsg, &addinfo)))
-       fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
+    ZOOM_connection_option_set(z, "saveAPDU", "1");
+    r = ZOOM_connection_search_pqf (z, argv[2]);
+    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
+        fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
     else
-       printf ("Result count: %d\n", Z3950_resultset_size(r));
-    Z3950_resultset_destroy (r);
-    Z3950_connection_destroy (z);
+        printf ("Result count: %ld\n", (long) ZOOM_resultset_size(r));
+    puts("APDUlog");
+    puts(ZOOM_connection_option_get(z, "APDU"));
+    ZOOM_resultset_destroy (r);
+    ZOOM_connection_destroy (z);
     exit (0);
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+