All databases with prefix db allowed
[yaz-moved-to-github.git] / ztest / ztest.c
index acefb59..0cf54d1 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2009 Index Data
+ * Copyright (C) 1995-2010 Index Data
  * See the file LICENSE for details.
  */
 
@@ -128,9 +128,11 @@ int ztest_search(void *handle, bend_search_rr *rr)
         rr->errcode = YAZ_BIB1_COMBI_OF_SPECIFIED_DATABASES_UNSUPP;
         return 0;
     }
-    /* Throw Database unavailable if other than Default or Slow */
+    /* Allow Default, db.* and Slow */
     if (!yaz_matchstr(rr->basenames[0], "Default"))
         ;  /* Default is OK in our test */
+    else if (!strncmp(rr->basenames[0], "db", 2))
+        ;  /* db.* is OK in our test */
     else if (check_slow(rr->basenames[0], rr->association))
     {
         rr->estimated_hit_count = 1;
@@ -721,7 +723,7 @@ int ztest_scan(void *handle, bend_scan_rr *q)
             return 0;
         }
         len = q->term->term->u.general->len;
-        if (len >= sizeof(term))
+        if (len >= (int ) sizeof(term))
             len = sizeof(term)-1;
         memcpy(term, q->term->term->u.general->buf, len);
         term[len] = '\0';