summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-22 20:53:12 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-22 20:53:12 +0800
commitb84f597ee5c156f741dd3aabfc8b18e0f997e684 (patch)
tree79870a9706103e821d697d34ce77c14b13252e53
parent21295b3ae2d324312c343898db97f53b989d48b4 (diff)
downloadpttbbs-b84f597ee5c156f741dd3aabfc8b18e0f997e684.tar
pttbbs-b84f597ee5c156f741dd3aabfc8b18e0f997e684.tar.gz
pttbbs-b84f597ee5c156f741dd3aabfc8b18e0f997e684.tar.bz2
pttbbs-b84f597ee5c156f741dd3aabfc8b18e0f997e684.tar.lz
pttbbs-b84f597ee5c156f741dd3aabfc8b18e0f997e684.tar.xz
pttbbs-b84f597ee5c156f741dd3aabfc8b18e0f997e684.tar.zst
pttbbs-b84f597ee5c156f741dd3aabfc8b18e0f997e684.zip
fix malfunction of '[', ']', '=' keys on article with long title
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2207 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/common.h3
-rw-r--r--innbbsd/Makefile3
-rw-r--r--mbbsd/bbs.c5
-rw-r--r--mbbsd/read.c6
4 files changed, 11 insertions, 6 deletions
diff --git a/include/common.h b/include/common.h
index 04a351dd..d57d3e93 100644
--- a/include/common.h
+++ b/include/common.h
@@ -147,6 +147,9 @@
#define LEN_AUTHOR1 5
#define LEN_AUTHOR2 7
+/* the title of article will be truncate to PROPER_TITLE_LEN */
+#define PROPER_TITLE_LEN 42
+
/* ----------------------------------------------------- */
/* 水球模式 邊界定義 */
diff --git a/innbbsd/Makefile b/innbbsd/Makefile
index 585bce6f..1dfd7d16 100644
--- a/innbbsd/Makefile
+++ b/innbbsd/Makefile
@@ -28,7 +28,8 @@ BBS_DEP = MapleBBS
BBS_UTIL = $(BBS_SRC)/util
BBS_REC = $(BBS_UTIL)/util_record.o $(BBS_UTIL)/util_cache.o \
$(BBS_UTIL)/util_passwd.o $(BBS_UTIL)/util_stuff.o \
- $(BBS_UTIL)/util_var.o $(BBS_REC_EXTRA_$(OSTYPE))
+ $(BBS_UTIL)/util_var.o $(BBS_UTIL)/util_file.o \
+ $(BBS_REC_EXTRA_$(OSTYPE))
BBS_REC_EXTRA_Linux = $(BBS_UTIL)/util_osdep.o
BBS_REC_EXTRA_Solaris = $(BBS_UTIL)/util_osdep.o
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 1c7fd538..b98070d5 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -195,8 +195,9 @@ readdoent(int num, fileheader_t * ent)
else
color = '3', mark = "R:";
- if (title[45]) /* 把多餘的 string 砍掉 */
- strlcpy(title + 42, " …", sizeof(title) - 42);
+ /* 把多餘的 string 砍掉 */
+ if (title[45])
+ strlcpy(title + PROPER_TITLE_LEN, " …", sizeof(title) - PROPER_TITLE_LEN);
if (!strncmp(title, "[公告]", 6))
special = 1;
diff --git a/mbbsd/read.c b/mbbsd/read.c
index cb48b594..0a1e7197 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -278,12 +278,12 @@ thread(keeploc_t * locmem, int stypen)
get_record_keep(currdirect, &fh, sizeof(fileheader_t), new_ln, &fd);
if( stypen & RS_TITLE ){
if( stypen & RS_FIRST ){
- if( !strcmp(fh.title, key) )
+ if( !strncmp(fh.title, key, PROPER_TITLE_LEN) )
break;
- else if( !strcmp(&fh.title[4], key) )
+ else if( !strncmp(&fh.title[4], key, PROPER_TITLE_LEN) )
amatch = new_ln;
}
- else if( !strcmp(subject(fh.title), key) )
+ else if( !strncmp(subject(fh.title), key, PROPER_TITLE_LEN) )
break;
}
else if( stypen & RS_NEWPOST ){