summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2013-03-10 20:23:01 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2013-03-10 20:23:01 +0800
commit3c40ba99eb5ef9cebf5941e3611963d7a5a407a5 (patch)
tree4b7aad43b511c7446a7379a48016d04a929b4164
parent3687152db4a52a213f3d4ada44e14e34357acc8d (diff)
downloadpttbbs-3c40ba99eb5ef9cebf5941e3611963d7a5a407a5.tar
pttbbs-3c40ba99eb5ef9cebf5941e3611963d7a5a407a5.tar.gz
pttbbs-3c40ba99eb5ef9cebf5941e3611963d7a5a407a5.tar.bz2
pttbbs-3c40ba99eb5ef9cebf5941e3611963d7a5a407a5.tar.lz
pttbbs-3c40ba99eb5ef9cebf5941e3611963d7a5a407a5.tar.xz
pttbbs-3c40ba99eb5ef9cebf5941e3611963d7a5a407a5.tar.zst
pttbbs-3c40ba99eb5ef9cebf5941e3611963d7a5a407a5.zip
Fix category editing UI
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5801 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/board.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/pttbbs/mbbsd/board.c b/pttbbs/mbbsd/board.c
index e176508a..462c615d 100644
--- a/pttbbs/mbbsd/board.c
+++ b/pttbbs/mbbsd/board.c
@@ -229,7 +229,7 @@ b_posttype()
boardheader_t *bp;
int i, modified = 0, types = 0;
char filepath[PATHLEN], genbuf[60];
- char posttype_f, posttype[33]="", *p;
+ char posttype_f, posttype[sizeof(bp->posttype)]="", *p;
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
bp = getbcache(currbid);
@@ -245,6 +245,10 @@ b_posttype()
strlcpy(genbuf, p, 5);
prints(" %d. %s %s\n", i + 1, genbuf,
posttype_f & (1 << i) ? "(有範本)": "");
+ // Workaround broken items
+ if (strlen(p) < 4) {
+ memset(p + strlen(p), ' ', 4 - strlen(p));
+ }
}
types = i;
if (!getdata(15, 0,
@@ -271,7 +275,9 @@ b_posttype()
continue;
strlcpy(genbuf, posttype + i * 4, 5);
if(getdata_str(16, 0, "類別名稱: ", genbuf, 5, DOECHO, genbuf)) {
- snprintf(posttype + i * 4, 4, "%-4.4s", genbuf);
+ char tmp[5];
+ snprintf(tmp, sizeof(tmp), "%-4.4s", genbuf);
+ memcpy(posttype + (i * 4), tmp, 4);
}
getdata(17, 0, "要使用範本嗎? [y/n/K(不改變)]: ", genbuf, 2, LCECHO);
if (genbuf[0] == 'y')
@@ -298,8 +304,10 @@ b_posttype()
strlcpy(bp->posttype, posttype, sizeof(bp->posttype));
modified = 1;
}
- if (modified)
+ if (modified) {
substitute_record(fn_board, bp, sizeof(boardheader_t), currbid);
+ vmsg("資料已更新。");
+ }
return FULLUPDATE;
}