summaryrefslogtreecommitdiffstats
path: root/mbbsd/friend.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-23 03:02:01 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-23 03:02:01 +0800
commit8b45fd166b943e17dabb3f5cdf972baeb58e0346 (patch)
tree7b2e5bf09b7c9fd812d0ae7cacdfa049c4dc1e07 /mbbsd/friend.c
parenta1bd04d7decea39d51bbc06b50755976d4184c50 (diff)
downloadpttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar
pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.gz
pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.bz2
pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.lz
pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.xz
pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.zst
pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.zip
sprintf() -> snprintf()
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@435 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/friend.c')
-rw-r--r--mbbsd/friend.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/mbbsd/friend.c b/mbbsd/friend.c
index 6029bfd8..2df2025b 100644
--- a/mbbsd/friend.c
+++ b/mbbsd/friend.c
@@ -1,4 +1,4 @@
-/* $Id: friend.c,v 1.11 2002/07/21 09:26:02 in2 Exp $ */
+/* $Id: friend.c,v 1.12 2002/07/22 19:02:00 in2 Exp $ */
#include "bbs.h"
/* ------------------------------------- */
@@ -114,7 +114,7 @@ friend_special()
friend_file[FRIEND_SPECIAL] = special_list;
for (i = 0; i <= 9; i++) {
- sprintf(genbuf, " (\033[36m%d\033[m) .. ", i);
+ snprintf(genbuf, sizeof(genbuf), " (\033[36m%d\033[m) .. ", i);
special_des[5] = i + '0';
setuserfile(fname, special_des);
if (dashf(fname)) {
@@ -153,15 +153,17 @@ friend_append(int type, int count)
for (j = i = 0; i <= 4; i++)
if (i != type) {
++j;
- sprintf(buf, " (%d) %-s\n", i + 1, friend_list[(int)i]);
+ snprintf(buf, sizeof(buf),
+ " (%d) %-s\n", i + 1, friend_list[(int)i]);
outs(buf);
}
if (HAVE_PERM(PERM_SYSOP) || currmode & MODE_BOARD)
for (; i < 8; ++i)
if (i != type) {
++j;
- sprintf(buf, " (%d) %s 板的 %s\n", j, currboard,
- friend_list[(int)i]);
+ snprintf(buf, sizeof(buf),
+ " (%d) %s 板的 %s\n", j, currboard,
+ friend_list[(int)i]);
outs(buf);
}
outs(" (S) 選擇其他看板的特別名單");
@@ -229,7 +231,7 @@ friend_editdesc(char *uident, int type)
FILE *fp, *nfp;
char fnnew[200], genbuf[200], fn[200];
setfriendfile(fn, type);
- sprintf(fnnew, "%s-", fn);
+ snprintf(fnnew, sizeof(fnnew), "%s-", fn);
if ((fp = fopen(fn, "r")) && (nfp = fopen(fnnew, "w"))) {
int length = strlen(uident);
@@ -324,7 +326,8 @@ friend_edit(int type)
if (type == FRIEND_ALOHA || type == FRIEND_POST) {
if (dashf(fpath)) {
- sprintf(genbuf, "/bin/cp %s %s.old", fpath, fpath);
+ snprintf(genbuf, sizeof(genbuf),
+ "/bin/cp %s %s.old", fpath, fpath);
system(genbuf);
}
}
@@ -332,7 +335,7 @@ friend_edit(int type)
while (1) {
stand_title(friend_list[type]);
move(0, 40);
- sprintf(line, "(名單上限:%d個人)", friend_max[type]);
+ snprintf(line, sizeof(line), "(名單上限:%d個人)", friend_max[type]);
outs(line);
count = 0;
CreateNameList();
@@ -406,7 +409,7 @@ friend_edit(int type)
outs("更新資料中..請稍候.....");
refresh();
if (type == FRIEND_ALOHA || type == FRIEND_POST) {
- sprintf(genbuf, "%s.old", fpath);
+ snprintf(genbuf, sizeof(genbuf), "%s.old", fpath);
if ((fp = fopen(genbuf, "r"))) {
while (fgets(line, 80, fp)) {
sscanf(line, "%s", uident);
@@ -416,7 +419,7 @@ friend_edit(int type)
}
fclose(fp);
}
- sprintf(genbuf, "%s", fpath);
+ snprintf(genbuf, sizeof(genbuf), "%s", fpath);
if ((fp = fopen(genbuf, "r"))) {
while (fgets(line, 80, fp)) {
sscanf(line, "%s", uident);