More options handling for scan.
[yaz-moved-to-github.git] / zoom / zoom-c.c
index 094c6e6..2c6297b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoom-c.c,v 1.16 2002-01-02 10:30:25 adam Exp $
+ * $Id: zoom-c.c,v 1.18 2002-01-03 12:18:38 adam Exp $
  *
  * ZOOM layer for C, connections, result sets, queries.
  */
@@ -446,7 +446,6 @@ static void ZOOM_resultset_retrieve (ZOOM_resultset r,
 {
     ZOOM_task task;
     ZOOM_connection c;
-    const char *cp;
 
     if (!r)
        return;
@@ -1093,7 +1092,17 @@ static int scan_response (ZOOM_connection c, Z_ScanResponse *res)
         response_diag(c, res->entries->nonsurrogateDiagnostics[0]);
     scan->scan_response = res;
     nmem_transfer (scan->odr->mem, nmem);
+    if (res->stepSize)
+        ZOOM_options_set_int (scan->options, "stepSize", *res->stepSize);
+    if (res->positionOfTerm)
+        ZOOM_options_set_int (scan->options, "position", *res->positionOfTerm);
+    if (res->scanStatus)
+        ZOOM_options_set_int (scan->options, "scanStatus", *res->scanStatus);
+    if (res->numberOfEntriesReturned)
+        ZOOM_options_set_int (scan->options, "number",
+                              *res->numberOfEntriesReturned);
     nmem_destroy (nmem);
+    return 1;
 }
 
 static int send_sort (ZOOM_connection c)
@@ -1350,6 +1359,17 @@ const char *ZOOM_scanset_term (ZOOM_scanset scan, size_t pos,
     return term;
 }
 
+const char *ZOOM_scanset_option_get (ZOOM_scanset scan, const char *key)
+{
+    return ZOOM_options_get (scan->options, key);
+}
+
+void ZOOM_scanset_option_set (ZOOM_scanset scan, const char *key,
+                              const char *val)
+{
+    ZOOM_options_set (scan->options, key, val);
+}
+
 static int ZOOM_connection_exec_task (ZOOM_connection c)
 {
     ZOOM_task task = c->tasks;
@@ -1841,7 +1861,7 @@ int ZOOM_event (int no, ZOOM_connection *cs)
        }
        if (r == 0 && c->mask)
        {
-            ZOOM_Event event = ZOOM_Event_create(ZOOM_EVENT_IO_TIMEOUT);
+            ZOOM_Event event = ZOOM_Event_create(ZOOM_EVENT_TIMEOUT);
            /* timeout and this connection was waiting */
            c->error = ZOOM_ERROR_TIMEOUT;
             do_close (c);