- if (sscanf(line, ZINT_FORMAT " " ZINT_FORMAT " " ZINT_FORMAT " %39s %n",
- &recWord.record_id, &recWord.section_id, &recWord.seqno,
- field, &nor) < 4)
- {
- yaz_log(YLOG_WARN, "Bad safari record line: %s", line);
- return RECCTRL_EXTRACT_ERROR_GENERIC;
- }
- for (cp = line + nor; *cp == ' '; cp++)
+ type_cstr[1] = '\0';
+ if (*cp >= '0' && *cp <= '9')
+ type_cstr[0] = '0'; /* the default is 0 (raw) */
+ else
+ type_cstr[0] = *cp++; /* type given */
+ type_cstr[1] = '\0';
+
+ recWord.index_type = type_cstr;
+ if (tinfo->segments)
+ {
+ if (sscanf(cp, ZINT_FORMAT " " ZINT_FORMAT " " ZINT_FORMAT
+ ZINT_FORMAT " %39s %n",
+ &recWord.record_id, &recWord.section_id,
+ &recWord.segment,
+ &recWord.seqno,
+ field, &nor) < 5)
+ {
+ yaz_log(YLOG_WARN, "Bad safari record line: %s", line);
+ return RECCTRL_EXTRACT_ERROR_GENERIC;
+ }
+ }
+ else
+ {
+ if (sscanf(cp, ZINT_FORMAT " " ZINT_FORMAT " " ZINT_FORMAT " %39s %n",
+ &recWord.record_id, &recWord.section_id, &recWord.seqno,
+ field, &nor) < 4)
+ {
+ yaz_log(YLOG_WARN, "Bad safari record line: %s", line);
+ return RECCTRL_EXTRACT_ERROR_GENERIC;
+ }
+ }
+ for (cp = cp + nor; *cp == ' '; cp++)