- const char *db = ZOOM_record_get (rec, "database", 0);
- int len;
- const char *render = ZOOM_record_get (rec, "render", &len);
- const char *syntax = ZOOM_record_get (rec, "syntax", 0);
- /* if rec is non-null, we got a record for display */
- if (rec)
- {
- printf ("%d %s %s\n", pos+1, (db ? db : "unknown"), syntax);
- if (render)
- fwrite (render, 1, len, stdout);
- printf ("\n");
- }
+ const char *db = ZOOM_record_get (rec, "database", 0);
+
+ if (ZOOM_record_error(rec, 0, 0, 0))
+ {
+ const char *msg;
+ const char *addinfo;
+ const char *diagset;
+ int error = ZOOM_record_error(rec, &msg, &addinfo, &diagset);
+
+ printf("%d %s: %s (%s:%d) %s\n", pos, (db ? db : "unknown"),
+ msg, diagset, error, addinfo);
+ }
+ else
+ {
+ int len, opac_len;
+ const char *render = ZOOM_record_get (rec, "render", &len);
+ const char *opac_render = ZOOM_record_get (rec, "opac", &opac_len);
+ const char *syntax = ZOOM_record_get (rec, "syntax", 0);
+ /* if rec is non-null, we got a record for display */
+ if (rec)
+ {
+ printf ("%d %s %s\n",
+ pos, (db ? db : "unknown"), syntax);
+ if (render)
+ fwrite (render, 1, len, stdout);
+ printf ("\n");
+ if (opac_render)
+ fwrite (opac_render, 1, opac_len, stdout);
+ }
+ }
+