+ if((buf = icwcstombs(cur->str, DCCHARSET)) == NULL)
+ {
+ /* Can't find anything anyway if the search expression
+ * requires characters outside DC's charset. There's
+ * nothing technically wrong with the search itself,
+ * however, so return success. This should be
+ * considered as an optimization. */
+ freesl(&list);
+ if(sstr != NULL)
+ free(sstr);
+ return(0);
+ }
+ if(cur != list)
+ addtobuf(sstr, '$');
+ /*
+ * It probably doesn't hurt if buf contains any extra
+ * dollar signs - it will just result in extra search
+ * terms, and the extraneous results will be filtered by
+ * the search layer anyway. It hurts if it contains any
+ * pipes, though, so let's sell them for money.
+ */
+ for(p = buf; *p; p++)
+ {
+ if(*p == '|')
+ *p = '$';
+ }
+ bufcat(sstr, buf, strlen(buf));
+ free(buf);