zoomsh: Refactor command show
[yaz-moved-to-github.git] / zoom / zoomtst5.c
index b2e466d..be3dbd0 100644 (file)
@@ -1,7 +1,6 @@
-/*
- * $Id: zoomtst5.c,v 1.10 2005-06-25 15:46:08 adam Exp $
- *
- * Asynchronous multi-target client doing search, sort and present
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2009 Index Data
+ * See the file LICENSE for details.
  */
 
 #include <stdio.h>
@@ -84,8 +83,8 @@ int main(int argc, char **argv)
         {
             /* OK, no major errors. Look at the result count */
             int pos;
-            printf ("%s: %d hits\n", ZOOM_connection_option_get(z[i], "host"),
-                    ZOOM_resultset_size(r[i]));
+            printf ("%s: %ld hits\n", ZOOM_connection_option_get(z[i], "host"),
+                    (long) ZOOM_resultset_size(r[i]));
             /* go through first 20 records at target */
             for (pos = 0; pos < 20; pos++)
             {
@@ -105,7 +104,10 @@ int main(int argc, char **argv)
                     printf ("%d %s %s\n", pos+1, syntax, 
                             (db ? db : "unknown"));
                     if (rec)
-                        fwrite (str, 1, len, stdout);
+                    {
+                        if (fwrite (str, 1, len, stdout) != (size_t) len)
+                            printf("write to stdout failed\n");
+                    }
                     printf ("\n");
                 }
             }
@@ -125,6 +127,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