summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
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);
}
}