- if (!yaz_matchstr (argv[0], "index") && argc == 2)
- {
- if (!zm)
- zm = &zms->map_list;
- else
- zm = &(*zm)->next;
- *zm = (struct zebra_map *) nmem_malloc (zms->nmem, sizeof(**zm));
- (*zm)->reg_id = argv[1][0];
- (*zm)->maptab_name = NULL;
- (*zm)->maptab = NULL;
- (*zm)->type = ZEBRA_MAP_TYPE_INDEX;
- (*zm)->completeness = 0;
- (*zm)->positioned = 1;
- (*zm)->replace_tokens = 0;
- }
- else if (!yaz_matchstr (argv[0], "sort") && argc == 2)
- {
- if (!zm)
- zm = &zms->map_list;
- else
- zm = &(*zm)->next;
- *zm = (struct zebra_map *) nmem_malloc (zms->nmem, sizeof(**zm));
- (*zm)->reg_id = argv[1][0];
- (*zm)->maptab_name = NULL;
- (*zm)->type = ZEBRA_MAP_TYPE_SORT;
- (*zm)->u.sort.entry_size = 80;
- (*zm)->maptab = NULL;
- (*zm)->completeness = 0;
- (*zm)->positioned = 0;
- (*zm)->replace_tokens = 0;
- }
- else if (zm && !yaz_matchstr (argv[0], "charmap") && argc == 2)
- {
- (*zm)->maptab_name = nmem_strdup (zms->nmem, argv[1]);
- }
- else if (zm && !yaz_matchstr (argv[0], "completeness") && argc == 2)
- {
- (*zm)->completeness = atoi (argv[1]);
- }
- else if (zm && !yaz_matchstr (argv[0], "position") && argc == 2)
- {
- (*zm)->positioned = atoi (argv[1]);
- }
- else if (zm && !yaz_matchstr (argv[0], "entrysize") && argc == 2)
+ yaz_log(YLOG_WARN, "%s:%d: Too many arguments for '%s'",
+ fname, lineno, argv[0]);
+ return -1;
+ }
+ if (!yaz_matchstr(argv[0], "index"))
+ {
+ zm = zebra_add_map(zms, argv[1], ZEBRA_MAP_TYPE_INDEX);
+ zm->positioned = 1;
+ }
+ else if (!yaz_matchstr(argv[0], "sort"))
+ {
+ zm = zebra_add_map(zms, argv[1], ZEBRA_MAP_TYPE_SORT);
+ zm->u.sort.entry_size = 80;
+ }
+ else if (!yaz_matchstr(argv[0], "staticrank"))
+ {
+ zm = zebra_add_map(zms, argv[1], ZEBRA_MAP_TYPE_STATICRANK);
+ zm->completeness = 1;
+ }
+ else if (!zm)
+ {
+ yaz_log(YLOG_WARN, "%s:%d: Missing sort/index before '%s'",
+ fname, lineno, argv[0]);
+ return -1;
+ }
+ else if (!yaz_matchstr(argv[0], "charmap") && argc == 2)
+ {
+ if (zm->type != ZEBRA_MAP_TYPE_STATICRANK)
+ zm->maptab_name = nmem_strdup(zms->nmem, argv[1]);
+ else
+ {
+ yaz_log(YLOG_WARN|YLOG_FATAL, "%s:%d: charmap for "
+ "staticrank is invalid", fname, lineno);
+ yaz_log(YLOG_LOG, "Type is %d", zm->type);
+ return -1;
+ }
+ }
+ else if (!yaz_matchstr(argv[0], "completeness") && argc == 2)
+ {
+ zm->completeness = atoi(argv[1]);
+ }
+ else if (!yaz_matchstr(argv[0], "position") && argc == 2)
+ {
+ zm->positioned = atoi(argv[1]);
+ }
+ else if (!yaz_matchstr(argv[0], "alwaysmatches") && argc == 2)
+ {
+ if (zm->type != ZEBRA_MAP_TYPE_STATICRANK)
+ zm->alwaysmatches = atoi(argv[1]);
+ else