+ else if (!yaz_matchstr(argv[0], "equivalent"))
+ {
+ chr_equiv_work w;
+
+ if (argc != 2)
+ {
+ yaz_log(YLOG_FATAL, "equivalent requires 1 argument");
+ ++errors;
+ }
+ w.nmem = res->nmem;
+ w.no_eq = 0;
+ if (scan_string(argv[1], t_unicode, t_utf8,
+ fun_add_equivalent_string, &w, 0) < 0)
+ {
+ yaz_log(YLOG_FATAL, "equivalent: invalid string");
+ ++errors;
+ }
+ else if (w.no_eq == 0)
+ {
+ yaz_log(YLOG_FATAL, "equivalent: no strings");
+ ++errors;
+ }
+ else
+ {
+ char *result_str;
+ int i, slen = 5;
+
+ /* determine length of regular expression */
+ for (i = 0; i<w.no_eq; i++)
+ slen += strlen(w.eq[i]) + 1;
+ result_str = nmem_malloc(res->nmem, slen + 5);
+
+ /* build the regular expression */
+ *result_str = '\0';
+ slen = 0;
+ for (i = 0; i<w.no_eq; i++)
+ {
+ result_str[slen++] = i ? '|' : '(';
+ strcpy(result_str + slen, w.eq[i]);
+ slen += strlen(w.eq[i]);
+ }
+ result_str[slen++] = ')';
+ result_str[slen] = '\0';
+
+ /* each eq will map to this regular expression */
+ for (i = 0; i<w.no_eq; i++)
+ {
+ set_map_string(res->q_input, res->nmem,
+ w.eq[i], strlen(w.eq[i]),
+ result_str, 0);
+ }
+ }
+ }
+ else if (!yaz_matchstr(argv[0], "encoding"))
+ {
+ /*
+ * Fix me. When t_unicode==0 and use encoding directive in *.chr file the beheviour of the
+ * zebra need to comment next part of code.
+ */
+
+ /* Original code */
+#if 1
+ if (t_unicode != 0)
+ yaz_iconv_close (t_unicode);
+ t_unicode = yaz_iconv_open (ucs4_native, argv[1]);
+#endif
+ /*
+ * Fix me. It is additional staff for conversion of characters from local encoding
+ * of *.chr file to UTF-8 (internal encoding).
+ * NOTE: The derective encoding must be first directive in *.chr file.
+ */
+ /* For whatever reason Oleg enabled this.. */
+#if 0
+ if (t_utf8 != 0)
+ yaz_iconv_close(t_utf8);
+ t_utf8 = yaz_iconv_open ("UTF-8", argv[1]);
+#endif
+ }