summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2011-07-23 15:05:46 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2011-07-23 15:05:46 +0800
commit179abe13e836ecfd85ee724c9ac77b6ad8b07d78 (patch)
treee6b70b8c3333dc20a5ae4a6b799055673d5e5107
parentea89b4a32a2d51e4944a5f71ff7deed72faffa17 (diff)
downloadpttbbs-179abe13e836ecfd85ee724c9ac77b6ad8b07d78.tar
pttbbs-179abe13e836ecfd85ee724c9ac77b6ad8b07d78.tar.gz
pttbbs-179abe13e836ecfd85ee724c9ac77b6ad8b07d78.tar.bz2
pttbbs-179abe13e836ecfd85ee724c9ac77b6ad8b07d78.tar.lz
pttbbs-179abe13e836ecfd85ee724c9ac77b6ad8b07d78.tar.xz
pttbbs-179abe13e836ecfd85ee724c9ac77b6ad8b07d78.tar.zst
pttbbs-179abe13e836ecfd85ee724c9ac77b6ad8b07d78.zip
trim keyword in search.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5380 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/board.c1
-rw-r--r--pttbbs/mbbsd/read.c13
2 files changed, 11 insertions, 3 deletions
diff --git a/pttbbs/mbbsd/board.c b/pttbbs/mbbsd/board.c
index 28f963c3..ba83e890 100644
--- a/pttbbs/mbbsd/board.c
+++ b/pttbbs/mbbsd/board.c
@@ -1680,6 +1680,7 @@ choose_board(int newflag)
} else {
getdata_buf(b_lines - 1, 0, "請輸入看板中文關鍵字:",
keyword, sizeof(keyword), DOECHO);
+ trim(keyword);
}
brdnum = -1;
break;
diff --git a/pttbbs/mbbsd/read.c b/pttbbs/mbbsd/read.c
index 9b3b81e9..bfc899a9 100644
--- a/pttbbs/mbbsd/read.c
+++ b/pttbbs/mbbsd/read.c
@@ -481,6 +481,12 @@ mail_forward(const fileheader_t * fhdr, const char *direct, int mode)
#endif
static int
+trim_blank(char *buf) {
+ trim(buf);
+ return *buf == 0;
+}
+
+static int
select_read(const keeploc_t * locmem, int sr_mode)
{
#define READSIZE 64 // 8192 / sizeof(fileheader_t)
@@ -507,14 +513,14 @@ select_read(const keeploc_t * locmem, int sr_mode)
{
if(!getdata(b_lines, 0,
currmode & MODE_SELECT ? "增加條件 作者: ":"搜尋作者: ",
- keyword, IDLEN+1, DOECHO))
+ keyword, IDLEN+1, DOECHO) || trim_blank(keyword))
return READ_REDRAW;
}
else if(sr_mode & RS_KEYWORD)
{
if(!getdata(b_lines, 0,
currmode & MODE_SELECT ? "增加條件 標題: ":"搜尋標題: ",
- keyword, TTLEN, DOECHO))
+ keyword, TTLEN, DOECHO) || trim_blank(keyword))
return READ_REDRAW;
#ifdef KEYWORD_LOG
log_filef("keyword_search_log", LOG_CREAT,
@@ -527,7 +533,8 @@ select_read(const keeploc_t * locmem, int sr_mode)
// let's use TTLEN-4 here.
if(!(currmode & MODE_SELECT) ||
!getdata(b_lines, 0, "增加條件 排除標題: ",
- keyword, TTLEN-4, DOECHO))
+ keyword, TTLEN-4, DOECHO) ||
+ trim_blank(keyword))
return READ_REDRAW;
}
else if (sr_mode & RS_RECOMMEND)