From b84f597ee5c156f741dd3aabfc8b18e0f997e684 Mon Sep 17 00:00:00 2001
From: victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>
Date: Wed, 22 Sep 2004 12:53:12 +0000
Subject: 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
---
 include/common.h | 3 +++
 innbbsd/Makefile | 3 ++-
 mbbsd/bbs.c      | 5 +++--
 mbbsd/read.c     | 6 +++---
 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
+
 
 /* ----------------------------------------------------- */
 /* ���y�Ҧ� ��ɩw�q                                     */
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])	/* ��h�l�� string �屼 */
-	strlcpy(title + 42, " �K", sizeof(title) - 42);
+    /* ��h�l�� string �屼 */
+    if (title[45])
+	strlcpy(title + PROPER_TITLE_LEN, " �K", sizeof(title) -  PROPER_TITLE_LEN);
 
     if (!strncmp(title, "[���i]", 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 ){
-- 
cgit v1.2.3