summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-06 20:51:26 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-06 20:51:26 +0800
commit6b20a689f6231482f7b6a51d2f7cdfd8f5d6207b (patch)
treed6a314ba01df0ab79223db30ef039f13a04222fc
parent8fef84f3270c7f7ad050619f46a2b93f507ebade (diff)
downloadpttbbs-6b20a689f6231482f7b6a51d2f7cdfd8f5d6207b.tar
pttbbs-6b20a689f6231482f7b6a51d2f7cdfd8f5d6207b.tar.gz
pttbbs-6b20a689f6231482f7b6a51d2f7cdfd8f5d6207b.tar.bz2
pttbbs-6b20a689f6231482f7b6a51d2f7cdfd8f5d6207b.tar.lz
pttbbs-6b20a689f6231482f7b6a51d2f7cdfd8f5d6207b.tar.xz
pttbbs-6b20a689f6231482f7b6a51d2f7cdfd8f5d6207b.tar.zst
pttbbs-6b20a689f6231482f7b6a51d2f7cdfd8f5d6207b.zip
dbcs aware topic search
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2908 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/read.c29
1 files changed, 25 insertions, 4 deletions
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 )