+static void cmd_scan (ZOOM_connection *c, ZOOM_resultset *r,
+ ZOOM_options options,
+ const char **args)
+{
+ const char *start_term = *args;
+ int i;
+ ZOOM_scanset s[MAX_CON];
+
+ while (*start_term == ' ')
+ start_term++;
+
+ for (i = 0; i<MAX_CON; i++)
+ {
+ if (c[i])
+ s[i] = ZOOM_connection_scan(c[i], start_term);
+ else
+ s[i] = 0;
+ }
+ while (ZOOM_event(MAX_CON, c))
+ ;
+ for (i = 0; i<MAX_CON; i++)
+ {
+ if (s[i]) {
+ size_t p, sz = ZOOM_scanset_size(s[i]);
+ for (p = 0; p < sz; p++)
+ {
+ int occ = 0;
+ int len = 0;
+ const char *term = ZOOM_scanset_display_term(s[i], p,
+ &occ, &len);
+ fwrite(term, 1, len, stdout);
+ printf (" %d\n", occ);
+ }
+ ZOOM_scanset_destroy(s[i]);
+ }
+ }
+}
+
+static void cmd_sort (ZOOM_connection *c, ZOOM_resultset *r,
+ ZOOM_options options,
+ const char **args)
+{
+ const char *sort_spec = *args;
+ int i;
+
+ while (*sort_spec == ' ')
+ sort_spec++;
+
+ for (i = 0; i<MAX_CON; i++)
+ {
+ if (r[i])
+ ZOOM_resultset_sort(r[i], "yaz", sort_spec);
+ }
+ while (ZOOM_event(MAX_CON, c))
+ ;
+}
+