- int error;
- const char *errmsg, *addinfo;
- if ((error = Z3950_connection_error(z[i], &errmsg, &addinfo)))
- fprintf (stderr, "%s error: %s (%d) %s\n",
- Z3950_connection_host(z[i]),
- errmsg, error, addinfo);
- else
- {
- /* OK, no major errors. Look at the result count */
- int pos;
- printf ("%s: %d hits\n", Z3950_connection_host(z[i]),
- Z3950_resultset_size(r[i]));
- /* go through all records at target */
- for (pos = 0; pos < 20; pos++)
- {
- Z3950_record rec;
- const char *db, *syntax, *str;
- int len;
-
- rec = Z3950_resultset_record (r[i], pos);
- /* get database for record and record itself at pos */
-
- db = Z3950_record_get (rec, "database", 0);
- str = Z3950_record_get (rec, "render", &len);
- syntax = Z3950_record_get (rec, "syntax", &len);
- /* if rec is non-null, we got a record for display */
- if (str)
- {
- printf ("%d %s %s\n", pos+1, syntax,
- (db ? db : "unknown"));
- if (rec)
- fwrite (str, 1, len, stdout);
- putchar ('\n');
- }
- Z3950_record_destroy (rec);
- }
- }
+ int error;
+ const char *errmsg, *addinfo;
+ if ((error = ZOOM_connection_error(z[i], &errmsg, &addinfo)))
+ fprintf (stderr, "%s error: %s (%d) %s\n",
+ ZOOM_connection_option_get(z[i], "host"),
+ errmsg, error, addinfo);
+ else
+ {
+ /* OK, no major errors. Look at the result count */
+ int pos;
+ 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++)
+ {
+ ZOOM_record rec;
+ const char *db, *syntax, *str;
+ int len;
+
+ rec = ZOOM_resultset_record (r[i], pos);
+ /* get database for record and record itself at pos */
+
+ db = ZOOM_record_get (rec, "database", 0);
+ str = ZOOM_record_get (rec, "xml", &len);
+ syntax = ZOOM_record_get (rec, "syntax", &len);
+ /* if rec is non-null, we got a record for display */
+ if (str)
+ {
+ printf ("%d %s %s\n", pos+1, syntax,
+ (db ? db : "unknown"));
+ if (rec)
+ fwrite (str, 1, len, stdout);
+ printf ("\n");
+ }
+ }
+ }