+static void zebra_map_read (ZebraMaps zms, const char *name)
+{
+ FILE *f;
+ char line[512];
+ char *argv[10];
+ int argc;
+ struct zebra_map **zm = 0;
+
+ if (!(f = yaz_path_fopen(zms->tabpath, name, "r")))
+ {
+ logf(LOG_WARN|LOG_ERRNO, "%s", name);
+ return ;
+ }
+ while ((argc = readconf_line(f, line, 512, argv, 10)))
+ {
+ if (!strcmp (argv[0], "index") && argc == 2)
+ {
+ if (!zm)
+ zm = &zms->map_list;
+ else
+ zm = &(*zm)->next;
+ *zm = nmem_malloc (zms->nmem, sizeof(**zm));
+ (*zm)->reg_type = argv[1][0];
+ (*zm)->maptab_name = NULL;
+ (*zm)->maptab = NULL;
+ (*zm)->completeness = 0;
+ }
+ else if (zm && !strcmp (argv[0], "charmap") && argc == 2)
+ {
+ (*zm)->maptab_name = nmem_strdup (zms->nmem, argv[1]);
+ }
+ else if (zm && !strcmp (argv[0], "completeness") && argc == 2)
+ {
+ (*zm)->completeness = atoi (argv[1]);
+ }
+ }
+ if (zm)
+ (*zm)->next = NULL;
+ fclose (f);
+}
+static void zms_map_handle (void *p, const char *name, const char *value)
+{
+ ZebraMaps zms = p;
+
+ zebra_map_read (zms, value);
+}
+
+ZebraMaps zebra_maps_open (const char *tabpath, Res res)