aboutsummaryrefslogtreecommitdiff
path: root/modules/substr/substr.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/substr/substr.c')
-rw-r--r--modules/substr/substr.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/modules/substr/substr.c b/modules/substr/substr.c
index d6f045b..49453da 100644
--- a/modules/substr/substr.c
+++ b/modules/substr/substr.c
@@ -30,7 +30,8 @@ substr_sel(int cmd, struct dico_key *key, const char *dict_word)
{
unsigned *sample;
unsigned *tmp;
- int res;
+ enum utf8_strpat_result res;
+ int ec;
switch (cmd) {
case DICO_SELECT_BEGIN:
@@ -45,9 +46,19 @@ substr_sel(int cmd, struct dico_key *key, const char *dict_word)
if (utf8_mbstr_to_wc(dict_word, &tmp, NULL))
return 0;
utf8_wc_strupper(tmp);
- res = !!utf8_wc_strstr(tmp, sample);
+ res = utf8_wc_strpat(tmp, sample, NULL);
+ ec = errno;
free(tmp);
- return res;
+ switch (res) {
+ case strpat_found:
+ return 1;
+
+ case strpat_error:
+ dico_log(L_ERR, ec, "can't match");
+ /* fall throuog */
+ case strpat_not_found:
+ return 0;
+ }
case DICO_SELECT_END:
free(key->call_data);

Return to:

Send suggestions and report system problems to the System administrator.