summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-05 13:39:47 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-05 13:39:47 +0800
commitc03bae9c450387cab3673827a21c7a607c5ed27b (patch)
treec887b358240eddaf553482e0ae69cf65b2d557da /mbbsd
parenta7f24c3154adb6e3d757efb20475ab13f5733d4d (diff)
downloadpttbbs-c03bae9c450387cab3673827a21c7a607c5ed27b.tar
pttbbs-c03bae9c450387cab3673827a21c7a607c5ed27b.tar.gz
pttbbs-c03bae9c450387cab3673827a21c7a607c5ed27b.tar.bz2
pttbbs-c03bae9c450387cab3673827a21c7a607c5ed27b.tar.lz
pttbbs-c03bae9c450387cab3673827a21c7a607c5ed27b.tar.xz
pttbbs-c03bae9c450387cab3673827a21c7a607c5ed27b.tar.zst
pttbbs-c03bae9c450387cab3673827a21c7a607c5ed27b.zip
- (internal) code refine
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4084 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/friend.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/mbbsd/friend.c b/mbbsd/friend.c
index 5ff03900..4f7a2987 100644
--- a/mbbsd/friend.c
+++ b/mbbsd/friend.c
@@ -47,6 +47,9 @@ static char * const friend_list[8] = {
"看板好友名單"
};
+/* sized in screen width */
+#define MAX_DESCLEN (40)
+
void
setfriendfile(char *fpath, int type)
{
@@ -72,20 +75,17 @@ friend_add(const char *uident, int type, const char* des)
return;
if ((uident[0] > ' ') && !belong(fpath, uident)) {
- char buf[STRLEN] = "", buf2[256];
+ char buf[MAX_DESCLEN] = "", buf2[STRLEN];
char t_uident[IDLEN + 1];
- const int maxdesclen = 40; // bounded screen width (due to prompt)
-
- assert(maxdesclen <= sizeof(buf));
/* Thor: avoid uident run away when get data */
strlcpy(t_uident, uident, sizeof(t_uident));
if (type != FRIEND_ALOHA && type != FRIEND_POST){
if(!des)
- getdata(2, 0, friend_desc[type], buf, maxdesclen, DOECHO);
+ getdata(2, 0, friend_desc[type], buf, sizeof(buf), DOECHO);
else
- getdata_str(2, 0, friend_desc[type], buf, maxdesclen, DOECHO, des);
+ getdata_str(2, 0, friend_desc[type], buf, sizeof(buf), DOECHO, des);
}
snprintf(buf2, sizeof(buf2), "%-13s%s\n", t_uident, buf);
@@ -279,8 +279,8 @@ friend_editdesc(const char *uident, int type)
if ((genbuf[0] > ' ') && strncmp(genbuf, uident, length))
fputs(genbuf, nfp);
else if (!strncmp(genbuf, uident, length)) {
- char buf[50] = "";
- getdata(2, 0, "修改描述:", buf, 40, DOECHO);
+ char buf[MAX_DESCLEN];
+ getdata(2, 0, "修改描述:", buf, MAX_DESCLEN, DOECHO);
fprintf(nfp, "%-13s%s\n", uident, buf);
}
}