From 6b20a689f6231482f7b6a51d2f7cdfd8f5d6207b Mon Sep 17 00:00:00 2001 From: piaip Date: Wed, 6 Jul 2005 12:51:26 +0000 Subject: dbcs aware topic search git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2908 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/read.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/read.c b/mbbsd/read.c index ca62d426..bee3f41a 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -385,6 +385,27 @@ mail_forward(const fileheader_t * fhdr, const char *direct, int mode) } #endif +inline static int +dbcs_strcasestr(const char* pool, const char *ptr) +{ + int len = strlen(ptr); + + while(*pool) + { + if(strncasecmp(pool, ptr, len) == 0) + return 1; + /* else */ + if(*pool < 0) + { + pool ++; + if(*pool == 0) + return 0; + } + pool ++; + } + return 0; +} + static int select_read(const keeploc_t * locmem, int sr_mode) { @@ -473,16 +494,16 @@ select_read(const keeploc_t * locmem, int sr_mode) !strncmp(fhs[i].title, "Re:", 3)) continue; else if((sr_mode & RS_AUTHOR) && - !strcasestr(fhs[i].owner, keyword)) + !dbcs_strcasestr(fhs[i].owner, keyword)) continue; else if((sr_mode & RS_KEYWORD) && - !strcasestr(fhs[i].title, keyword)) + !dbcs_strcasestr(fhs[i].title, keyword)) continue; else if(sr_mode & RS_KEYWORD_EXCLUDE && - strcasestr(fhs[i].title, keyword)) + dbcs_strcasestr(fhs[i].title, keyword)) continue; else if((sr_mode & RS_TITLE) && - strcmp(subject(fhs[i].title), keyword)) + strcasecmp(subject(fhs[i].title), keyword)) continue; else if ((sr_mode & RS_RECOMMEND) && fhs[i].recommend < n_recommend ) -- cgit v1.2.3