summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-04-29 03:35:29 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-04-29 03:35:29 +0800
commit747db9b7bed623d2d957aa14dbc6a505cf763be8 (patch)
tree479cf6940e240c6e6e2f8435e13d97f9269788c5
parent980b8d2d2504b7299ceee845aff46c1f593e498f (diff)
downloadpttbbs-747db9b7bed623d2d957aa14dbc6a505cf763be8.tar
pttbbs-747db9b7bed623d2d957aa14dbc6a505cf763be8.tar.gz
pttbbs-747db9b7bed623d2d957aa14dbc6a505cf763be8.tar.bz2
pttbbs-747db9b7bed623d2d957aa14dbc6a505cf763be8.tar.lz
pttbbs-747db9b7bed623d2d957aa14dbc6a505cf763be8.tar.xz
pttbbs-747db9b7bed623d2d957aa14dbc6a505cf763be8.tar.zst
pttbbs-747db9b7bed623d2d957aa14dbc6a505cf763be8.zip
change getdata() constant to sizeof()
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@131 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/admin.c33
-rw-r--r--mbbsd/announce.c30
-rw-r--r--mbbsd/bbcall.c16
-rw-r--r--mbbsd/bbs.c24
-rw-r--r--mbbsd/board.c5
-rw-r--r--mbbsd/cache.c3
-rw-r--r--mbbsd/cal.c29
-rw-r--r--mbbsd/card.c6
-rw-r--r--mbbsd/chat.c4
-rw-r--r--mbbsd/chicken.c12
-rw-r--r--mbbsd/dice.c4
-rw-r--r--mbbsd/edit.c35
-rw-r--r--mbbsd/friend.c9
-rw-r--r--mbbsd/gomo.c6
-rw-r--r--mbbsd/guess.c29
-rw-r--r--mbbsd/indict.c4
-rw-r--r--mbbsd/io.c6
-rw-r--r--mbbsd/lovepaper.c7
-rw-r--r--mbbsd/mail.c20
-rw-r--r--mbbsd/mbbsd.c6
-rw-r--r--mbbsd/more.c4
-rw-r--r--mbbsd/othello.c5
-rw-r--r--mbbsd/page.c4
-rw-r--r--mbbsd/read.c4
-rw-r--r--mbbsd/register.c26
-rw-r--r--mbbsd/syspost.c4
-rw-r--r--mbbsd/talk.c30
-rw-r--r--mbbsd/user.c52
-rw-r--r--mbbsd/vice.c5
-rw-r--r--mbbsd/vote.c12
-rw-r--r--mbbsd/voteboard.c7
-rw-r--r--mbbsd/xyz.c10
32 files changed, 244 insertions, 207 deletions
diff --git a/mbbsd/admin.c b/mbbsd/admin.c
index 61509ba6..2d66bfe4 100644
--- a/mbbsd/admin.c
+++ b/mbbsd/admin.c
@@ -1,4 +1,4 @@
-/* $Id: admin.c,v 1.6 2002/03/17 17:06:54 in2 Exp $ */
+/* $Id: admin.c,v 1.7 2002/04/28 19:35:28 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -53,7 +53,7 @@ static int search_key_user(char *passwdfile, int mode) {
clear();
getdata(0, 0, mode ? "請輸入使用者關鍵字[電話|地址|姓名|上站地點|"
- "email|小雞id] :" : "請輸入id :", key, 21, DOECHO);
+ "email|小雞id] :" : "請輸入id :", key, sizeof(key), DOECHO);
while((fread(&user, sizeof(user), 1, fp1)) > 0 && coun < MAX_USERS) {
if(!(++coun & 15)) {
move(1, 0);
@@ -184,7 +184,7 @@ unsigned int setperms(unsigned int pbits, char *pstring[]) {
}
clrtobot();
while(getdata(b_lines - 1, 0, "請按 [A-5] 切換設定,按 [Return] 結束:",
- choice, 3, LCECHO)) {
+ choice, sizeof(choice), LCECHO)) {
i = choice[0] - 'a';
if(i < 0)
i = choice[0] - '0' + 26;
@@ -234,7 +234,7 @@ int m_mod_board(char *bname) {
sprintf(genbuf, "看板 (E)設定 (V)違法/解除 %s (D)刪除 [Q]取消?",
HAS_PERM(PERM_SYSOP) ?
" (B)BVote (S)救回文章" : "");
- getdata(10, 0, genbuf, ans, 3, LCECHO);
+ getdata(10, 0, genbuf, ans, sizeof(ans), LCECHO);
switch(*ans) {
case 's':
@@ -350,9 +350,9 @@ int m_mod_board(char *bname) {
strncpy(newbh.title + 5, "●", 2);
if(HAS_PERM(PERM_SYSOP) && !(newbh.brdattr & BRD_HIDE)) {
- getdata_str(14, 0, "設定讀寫權限(Y/N)?", ans, 4, LCECHO, "N");
+ getdata_str(14, 0, "設定讀寫權限(Y/N)?", ans, sizeof(ans), LCECHO, "N");
if(*ans == 'y') {
- getdata_str(15, 0, "限制 [R]閱\讀 (P)發表?", ans, 4, LCECHO,
+ getdata_str(15, 0, "限制 [R]閱\讀 (P)發表?", ans, sizeof(ans), LCECHO,
"R");
if(*ans == 'p')
newbh.brdattr |= BRD_POSTMASK;
@@ -419,7 +419,7 @@ int x_file() {
"(X)刪除進站畫面"
#endif
"\n");
- getdata(b_lines - 1, 0, " (H)看板期限 (I)故鄉 (J)出站畫面 (K)生日卡 (L)節日 [Q]取消?", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, " (H)看板期限 (I)故鄉 (J)出站畫面 (K)生日卡 (L)節日 [Q]取消?", ans, sizeof(ans), LCECHO);
switch(ans[0]) {
case '1':
@@ -463,7 +463,7 @@ int x_file() {
break;
case 'g':
#ifdef MULTI_WELCOME_LOGIN
- getdata(b_lines - 1, 0, "第幾個進站畫面[0-4]", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, "第幾個進站畫面[0-4]", ans, sizeof(ans), LCECHO);
if( ans[0] == '1' ) { fpath = "etc/Welcome_login.1"; }
else if( ans[0] == '2' ){ fpath = "etc/Welcome_login.2"; }
else if( ans[0] == '3' ){ fpath = "etc/Welcome_login.3"; }
@@ -476,7 +476,7 @@ int x_file() {
#ifdef MULTI_WELCOME_LOGIN
case 'x':
- getdata(b_lines - 1, 0, "第幾個進站畫面[1-4]", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, "第幾個進站畫面[1-4]", ans, sizeof(ans), LCECHO);
if( ans[0] == '1' ) { unlink("etc/Welcome_login.1"); outs("ok"); }
else if( ans[0] == '2' ){ unlink("etc/Welcome_login.2"); outs("ok"); }
else if( ans[0] == '3' ){ unlink("etc/Welcome_login.3"); outs("ok"); }
@@ -533,7 +533,8 @@ int m_newbrd(int recover) {
}
do {
- if(!getdata(3, 0, msg_bid, newboard.brdname, IDLEN + 1, DOECHO))
+ if(!getdata(3, 0, msg_bid, newboard.brdname,
+ sizeof(newboard.brdname), DOECHO))
return -1;
} while(invalid_brdname(newboard.brdname));
@@ -588,12 +589,12 @@ int m_newbrd(int recover) {
strncpy(newboard.title + 5, "●", 2);
newboard.level = 0;
- getdata(11, 0, "板主名單:", newboard.BM, IDLEN * 3 + 3, DOECHO);
+ getdata(11, 0, "板主名單:", newboard.BM, sizeof(newboard.BM), DOECHO);
if(HAS_PERM(PERM_SYSOP) && !(newboard.brdattr & BRD_HIDE)) {
- getdata_str(14, 0, "設定讀寫權限(Y/N)?", ans, 3, LCECHO, "N");
+ getdata_str(14, 0, "設定讀寫權限(Y/N)?", ans, sizeof(ans), LCECHO, "N");
if(*ans == 'y') {
- getdata_str(15, 0, "限制 [R]閱\讀 (P)發表?", ans, 4, LCECHO, "R");
+ getdata_str(15, 0, "限制 [R]閱\讀 (P)發表?", ans, sizeof(ans), LCECHO, "R");
if(*ans == 'p')
newboard.brdattr |= BRD_POSTMASK;
else
@@ -808,7 +809,7 @@ int scan_register_form(char *regfile, int automode, int neednum) {
}
if(muser.userlevel & PERM_LOGINOK) {
getdata(b_lines - 1, 0, "\033[1;32m此帳號已經完成註冊, "
- "更新(Y/N/Skip)?\033[m[N] ", ans, 3, LCECHO);
+ "更新(Y/N/Skip)?\033[m[N] ", ans, sizeof(ans), LCECHO);
if(ans[0] != 'y' && ans[0] != 's')
ans[0] = 'd';
} else {
@@ -1004,7 +1005,7 @@ int m_register() {
}
}
fclose(fn);
- getdata(b_lines - 1, 0, "開始審核嗎(Auto/Yes/No)?[N] ", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, "開始審核嗎(Auto/Yes/No)?[N] ", ans, sizeof(ans), LCECHO);
if(ans[0] == 'a')
scan_register_form(fn_register, 1, 0);
else if(ans[0] == 'y')
@@ -1046,7 +1047,7 @@ int give_money() {
struct tm *pt = localtime(&t);
int to_all = 0, money = 0;
- getdata(0, 0, "指定使用者(S) 全站使用者(A) 取消(Q)?[S]", buf, 3, LCECHO);
+ getdata(0, 0, "指定使用者(S) 全站使用者(A) 取消(Q)?[S]", buf, sizeof(buf), LCECHO);
if(buf[0] == 'q')
return 1;
else if( buf[0] == 'a') {
diff --git a/mbbsd/announce.c b/mbbsd/announce.c
index 280306dc..5920e45e 100644
--- a/mbbsd/announce.c
+++ b/mbbsd/announce.c
@@ -1,4 +1,4 @@
-/* $Id: announce.c,v 1.4 2002/04/15 20:00:22 in2 Exp $ */
+/* $Id: announce.c,v 1.5 2002/04/28 19:35:28 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -287,7 +287,7 @@ static int g_searchtitle(gmenu_t* pm, int rev) {
static char search_str[30] = "";
int pos;
- if(getdata(b_lines - 1, 1,"[搜尋]關鍵字:", search_str, 40, DOECHO))
+ if(getdata(b_lines - 1, 1,"[搜尋]關鍵字:", search_str, sizeof(search_str), DOECHO))
if(!*search_str)
return pm->now;
@@ -438,7 +438,7 @@ static int a_searchtitle(menu_t *pm, int rev) {
static char search_str[40] = "";
int pos;
- getdata(b_lines - 1, 1, "[搜尋]關鍵字:", search_str, 40, DOECHO);
+ getdata(b_lines - 1, 1, "[搜尋]關鍵字:", search_str, sizeof(search_str), DOECHO);
if(!*search_str)
return pm->now;
@@ -893,7 +893,7 @@ static void a_pasteitem(menu_t *pm, int mode) {
}
if(mode) {
sprintf(buf, "確定要拷貝[%s]嗎(Y/N)?[N] ", copytitle);
- getdata(b_lines - 1, 1, buf, ans, 3, LCECHO);
+ getdata(b_lines - 1, 1, buf, ans, sizeof(ans), LCECHO);
} else
ans[0]='y';
if(ans[0] == 'y') {
@@ -959,7 +959,7 @@ static void a_appenditem(menu_t *pm, int isask) {
if(isask) {
sprintf(buf, "確定要將[%s]附加於此嗎(Y/N)?[N] ",
copytitle);
- getdata(b_lines - 2, 1, buf, ans, 3, LCECHO);
+ getdata(b_lines - 2, 1, buf, ans, sizeof(ans), LCECHO);
}
if(ans[0] == 'y') {
if((fp = fopen(fname, "a+"))) {
@@ -970,7 +970,7 @@ static void a_appenditem(menu_t *pm, int isask) {
if(isask)
getdata(b_lines - 1, 1,
"是否收錄簽名檔部份(Y/N)?[Y] ",
- ans, 3, LCECHO);
+ ans, sizeof(ans), LCECHO);
while(fgets(buf, sizeof(buf), fin)) {
if((ans[0] == 'n' ) &&
!strcmp(buf, "--\n"))
@@ -1044,7 +1044,7 @@ static void a_moveitem(menu_t *pm) {
int fail;
sprintf(buf, "請輸入第 %d 選項的新次序:", pm->now + 1);
- if(!getdata(b_lines - 1, 1, buf, newnum, 6, DOECHO))
+ if(!getdata(b_lines - 1, 1, buf, newnum, sizeof(newnum), DOECHO))
return;
num = (newnum[0] == '$') ? 9999 : atoi(newnum) - 1;
if(num >= pm->num)
@@ -1095,22 +1095,22 @@ static void a_delete(menu_t *pm) {
if(pm->header[pm->now - pm->page].filename[0] == 'H' &&
pm->header[pm->now - pm->page].filename[1] == '.') {
getdata(b_lines - 1, 1, "您確定要刪除此精華區連線嗎(Y/N)?[N] ",
- ans, 3, LCECHO);
+ ans, sizeof(ans), LCECHO);
if(ans[0] != 'y')
return;
if(delete_record(buf, FHSZ, pm->now + 1) == -1)
return;
} else if (dashl(fpath)) {
getdata(b_lines - 1, 1, "您確定要刪除此 symbolic link 嗎(Y/N)?[N] ",
- ans, 3, LCECHO);
+ ans, sizeof(ans), LCECHO);
if(ans[0] != 'y')
return;
if(delete_record(buf, FHSZ, pm->now + 1) == -1)
return;
unlink(fpath);
} else if(dashf(fpath)) {
- getdata(b_lines - 1, 1, "您確定要刪除此檔案嗎(Y/N)?[N] ", ans, 3,
- LCECHO);
+ getdata(b_lines - 1, 1, "您確定要刪除此檔案嗎(Y/N)?[N] ", ans,
+ sizeof(ans), LCECHO);
if(ans[0] != 'y')
return;
if(delete_record(buf, FHSZ, pm->now + 1) == -1)
@@ -1127,8 +1127,8 @@ static void a_delete(menu_t *pm) {
setbdir(buf, "deleted");
append_record(buf, &backup, sizeof(backup));
} else if (dashd(fpath)) {
- getdata(b_lines - 1, 1, "您確定要刪除整個目錄嗎(Y/N)?[N] ", ans, 3,
- LCECHO);
+ getdata(b_lines - 1, 1, "您確定要刪除整個目錄嗎(Y/N)?[N] ", ans,
+ sizeof(ans), LCECHO);
if(ans[0] != 'y')
return;
if(delete_record(buf, FHSZ, pm->now + 1) == -1)
@@ -1147,7 +1147,7 @@ static void a_delete(menu_t *pm) {
append_record(buf, &backup, sizeof(backup));
} else { /* Ptt 損毀的項目 */
getdata(b_lines - 1, 1, "您確定要刪除此損毀的項目嗎(Y/N)?[N] ",
- ans, 3, LCECHO);
+ ans, sizeof(ans), LCECHO);
if(ans[0] != 'y')
return;
if(delete_record(buf, FHSZ, pm->now + 1) == -1)
@@ -1438,7 +1438,7 @@ int a_menu(char *maintitle, char *path, int lastlevel) {
currstat == EDITEXP ?
"要把範例 Plugin 到文章嗎?[y/N]":
"確定要點這首歌嗎?[y/N]",
- ans, 3, LCECHO);
+ ans, sizeof(ans), LCECHO);
if(ans[0]=='y') {
strcpy(trans_buffer,fname);
Fexit = 1;
diff --git a/mbbsd/bbcall.c b/mbbsd/bbcall.c
index d7b2d33b..8fdc56d2 100644
--- a/mbbsd/bbcall.c
+++ b/mbbsd/bbcall.c
@@ -1,4 +1,4 @@
-/* $Id: bbcall.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: bbcall.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -150,14 +150,14 @@ static void halpha0943(char* CoId) {
int Year = 99, Month = 1, Day = 15, Hour = 13, Minute = 8;
sprintf(tmpbuf, "\033[1;37m請輸入您要傳呼的號碼\033[m : %s-", CoId);
- if(!getdata(7,0, tmpbuf, ID, 7, LCECHO) ||
+ if(!getdata(7,0, tmpbuf, ID, sizeof(ID), LCECHO) ||
!getdata(8,0, "\033[1;37m請輸入傳呼訊息\033[m:", tmpbuf, 63, LCECHO)) {
hpressanykey("放棄傳呼");
return;
}
pager_msg_encode(Msg,tmpbuf);
getdata(9, 0, "\033[1;37m如果你要馬上送請按 '1' "
- "如果要定時送請按 '2': \033[m", ans, 2, LCECHO);
+ "如果要定時送請按 '2': \033[m", ans, sizeof(ans), LCECHO);
if(ans[0] != '1')
gettime(0, &Year, &Month, &Day, &Hour, &Minute);
@@ -179,14 +179,14 @@ static void hcall0941() {
int year = 98, month = 12, day = 4, hour = 13, min = 8;
if(!getdata(7, 0, "\033[1;37 請您輸入您要傳呼的號碼 : 0941- \033[m",
- PAGER_NO, 7, LCECHO) ||
+ PAGER_NO, sizeof(PAGER_NO), LCECHO) ||
!getdata(8, 0, "\033[1;37m請輸入傳呼訊息\033[m:", trn, 17, LCECHO)) {
hpressanykey("放棄傳呼");
return;
}
pager_msg_encode(TRAN_MSG,trn);
getdata(9,0, "\033[1;37m如果你要馬上送請按 '1' "
- "如果要定時送請按 '2': \033[m", ans, 2, LCECHO);
+ "如果要定時送請按 '2': \033[m", ans, sizeof(ans), LCECHO);
if(ans[0] != '1') {
strcpy(TIME,"DELAY");
gettime(0, &year, &month, &day, &hour, &min);
@@ -212,14 +212,14 @@ static void hcall0948() {
clrtoeol();
if(!getdata(7, 0, "\033[1;37m請輸入您要傳呼的號碼\033[m:0948-",
- svc_no, 7, LCECHO) ||
+ svc_no, sizeof(svc_no), LCECHO) ||
!getdata(8, 0, "\033[1;37m請輸入傳呼訊息\033[m:", trn, 61, LCECHO)) {
hpressanykey("放棄傳呼");
return;
}
pager_msg_encode(message, trn);
getdata(9, 0, "\033[1;37m如果你要馬上送請按 '1' "
- "如果要定時送請按 '2'\033[m: ", ans, 2, LCECHO);
+ "如果要定時送請按 '2'\033[m: ", ans, sizeof(ans), LCECHO);
if(ans[0] != '1') {
gettime(1, &year, &month, &day, &hour, &min);
ya = 1;
@@ -248,7 +248,7 @@ int main_bbcall() {
" (4)0948 \033[m\n");
prints("\033[1;31m └────────────────────"
"─────────┘\033[m\n");
- getdata(7, 8, "\033[1;37m你的選擇? [1-4]\033[m", ch, 2, LCECHO);
+ getdata(7, 8, "\033[1;37m你的選擇? [1-4]\033[m", ch, sizeof(ch), LCECHO);
switch(ch[0]) {
case '1':
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 15db1c91..28322370 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1,4 +1,4 @@
-/* $Id: bbs.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: bbs.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -88,7 +88,7 @@ int save_violatelaw() {
"已經造成很多人的不便\033[m\n");
prints("\033[1;37m你是否確定以後不會再犯了?\033[m\n");
- if(!getdata(10,0,"確定嗎?[y/n]:", ok, 2, LCECHO) ||
+ if(!getdata(10,0,"確定嗎?[y/n]:", ok, sizeof(ok), LCECHO) ||
ok[0] == 'n' || ok[0] == 'N') {
mprints(22,0,"\033[1;31m等你想通了再來吧!! "
"我相信你不會知錯不改的~~~\033[m");
@@ -100,7 +100,7 @@ int save_violatelaw() {
cuser.vl_count, cuser.vl_count*1000);
mprints(11,0,buf);
- if(!getdata(10, 0, "要付錢[y/n]:", ok, 2, LCECHO) ||
+ if(!getdata(10, 0, "要付錢[y/n]:", ok, sizeof(ok), LCECHO) ||
ok[0] == 'N' || ok[0] == 'n') {
mprints(22,0, "\033[1;31m 嗯 存夠錢 再來吧!!!\033[m");
@@ -1347,9 +1347,9 @@ static int tar_addqueue(int ent, fileheader_t *fhdr, char *direct) {
return FULLUPDATE;
}
- getdata(6, 0, "要備份看版內容嗎(Y/N)?[Y]", ans, 2, LCECHO);
+ getdata(6, 0, "要備份看版內容嗎(Y/N)?[Y]", ans, sizeof(ans), LCECHO);
bakboard = (ans[0] == 'n' || ans[0] =='N') ? 0 : 1;
- getdata(7, 0, "要備份精華區內容嗎(Y/N)?[N]", ans, 2, LCECHO);
+ getdata(7, 0, "要備份精華區內容嗎(Y/N)?[N]", ans, sizeof(ans), LCECHO);
bakman = (ans[0] == 'y' || ans[0] =='Y') ? 1 : 0;
if( !bakboard && !bakman ){
move(8, 0);
@@ -1513,7 +1513,7 @@ static int b_post_note() {
if(currmode & MODE_BOARD) {
setbfile(buf, currboard, FN_POST_NOTE );
if(more(buf,NA) == -1) more("etc/"FN_POST_NOTE , NA);
- getdata(b_lines - 2, 0, "是否要用自訂post注意事項?", yn, 3, LCECHO);
+ getdata(b_lines - 2, 0, "是否要用自訂post注意事項?", yn, sizeof(yn), LCECHO);
if(yn[0] == 'y')
vedit(buf, NA, NULL);
else
@@ -1551,8 +1551,8 @@ static int bh_title_edit() {
bp = getbcache(currbid);
move(1,0);
clrtoeol();
- getdata_str(1,0,"請輸入看板新中文敘述:", genbuf,BTLEN -
- 16,DOECHO, bp->title + 7);
+ getdata_str(1,0,"請輸入看板新中文敘述:", genbuf,
+ BTLEN - 16, DOECHO, bp->title + 7);
if(!genbuf[0])
return 0;
@@ -1753,11 +1753,12 @@ static int change_hidden(int ent, fileheader_t *fhdr, char *direct)
return DONOTHING;
if( ((bh.brdattr & BRD_HIDE) && (bh.brdattr & BRD_POSTMASK)) ){
- getdata(1, 0, "目前板在隱形狀態, 要解隱形嘛(Y/N)?[N]", ans, 2, LCECHO);
+ getdata(1, 0, "目前板在隱形狀態, 要解隱形嘛(Y/N)?[N]",
+ ans, sizeof(ans), LCECHO);
if( ans[0] != 'y' && ans[0] != 'Y' )
return FULLUPDATE;
getdata(2, 0, "再確認一次, 真的要把板板公開嘛 @____@(Y/N)?[N]",
- ans, 2, LCECHO);
+ ans, sizeof(ans), LCECHO);
if( ans[0] != 'y' && ans[0] != 'Y' )
return FULLUPDATE;
if( bh.brdattr & BRD_HIDE ) bh.brdattr -= BRD_HIDE;
@@ -1768,7 +1769,8 @@ static int change_hidden(int ent, fileheader_t *fhdr, char *direct)
hbflreload(bid);
}
else{
- getdata(1, 0, "目前板在現形狀態, 要隱形嘛(Y/N)?[N]", ans, 2, LCECHO);
+ getdata(1, 0, "目前板在現形狀態, 要隱形嘛(Y/N)?[N]",
+ ans, sizeof(ans), LCECHO);
if( ans[0] != 'y' && ans[0] != 'Y' )
return FULLUPDATE;
bh.brdattr |= BRD_HIDE;
diff --git a/mbbsd/board.c b/mbbsd/board.c
index e97d6e3f..923bea0a 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1,4 +1,4 @@
-/* $Id: board.c,v 1.4 2002/04/15 20:00:22 in2 Exp $ */
+/* $Id: board.c,v 1.5 2002/04/28 19:35:28 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -837,7 +837,8 @@ static void choose_board(int newflag) {
show_brdlist(head, 1, newflag);
break;
case '/':
- getdata_buf(b_lines-1,0,"請輸入看板中文關鍵字:",keyword, 12, DOECHO);
+ getdata_buf(b_lines-1,0,"請輸入看板中文關鍵字:",
+ keyword, sizeof(keyword), DOECHO);
brdnum=-1;
break;
case 'S':
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index 03092a2f..dd00d010 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -1,4 +1,4 @@
-/* $Id: cache.c,v 1.20 2002/04/20 07:31:46 in2 Exp $ */
+/* $Id: cache.c,v 1.21 2002/04/28 19:35:28 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -980,7 +980,6 @@ void resolve_fcache() {
extern time_t login_start_time;
extern char *fn_visable;
-FILE *DEBUG = NULL;
void hbflreload(int bid)
{
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index 680ee9d6..6603925e 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -1,4 +1,4 @@
-/* $Id: cal.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: cal.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -100,7 +100,7 @@ extern char save_title[];
static int osong(char *defaultid) {
char destid[IDLEN + 1],buf[200],genbuf[200],filename[256],say[51];
- char receiver[60],ano[2];
+ char receiver[45],ano[2];
FILE *fp,*fp1;// *fp2;
fileheader_t mail;
time_t now;
@@ -136,30 +136,31 @@ static int osong(char *defaultid) {
outs(buf);
trans_buffer[0] = 0;
if(!defaultid){
- getdata(13, 0, "要點給誰呢:[可直接按 Enter 先選歌]", destid, IDLEN + 1, DOECHO);
+ getdata(13, 0, "要點給誰呢:[可直接按 Enter 先選歌]",
+ destid, sizeof(destid), DOECHO);
while (!destid[0]){
a_menu("點歌歌本", SONGBOOK,0 );
clear();
- getdata(13, 0, "要點給誰呢:[可按 Enter 重新選歌]", destid, IDLEN + 1, DOECHO);
+ getdata(13, 0, "要點給誰呢:[可按 Enter 重新選歌]",
+ destid, sizeof(destid), DOECHO);
}
}
else
strcpy(destid,defaultid);
/* Heat:點歌者匿名功能 */
- getdata(14,0, "要匿名嗎?[y/n]:", ano, 2, DOECHO);
+ getdata(14,0, "要匿名嗎?[y/n]:", ano, sizeof(ano), DOECHO);
if(!destid[0]) {
unlockutmpmode();
return 0;
}
- getdata_str(14, 0, "想要要對他(她)說..:", say, 51, DOECHO, "我愛妳..");
+ getdata_str(14, 0, "想要要對他(她)說..:", say,
+ sizeof(say), DOECHO, "我愛妳..");
sprintf(save_title, "%s:%s", (ano[0]=='y')?"匿名者":cuser.userid, say);
- getdata_str(16, 0, "寄到誰的信箱(可用E-mail)?", receiver, 45,
- LCECHO, destid);
-
-
+ getdata_str(16, 0, "寄到誰的信箱(可用E-mail)?",
+ receiver, sizeof(receiver), LCECHO, destid);
if (!trans_buffer[0]){
outs("\n接著要選歌囉..進入歌本好好的選一首歌吧..^o^");
@@ -278,7 +279,7 @@ int p_cloak() {
char buf[4];
getdata(b_lines-1, 0,
currutmp->invisible ? "確定要現身?[y/N]" : "確定要隱身?[y/N]",
- buf, 3, LCECHO);
+ buf, sizeof(buf), LCECHO);
if(buf[0] != 'y')
return 0;
if(cuser.money >= 19) {
@@ -295,14 +296,14 @@ int p_cloak() {
int p_from() {
char ans[4];
- getdata(b_lines-2, 0, "確定要改故鄉?[y/N]", ans, 3, LCECHO);
+ getdata(b_lines-2, 0, "確定要改故鄉?[y/N]", ans, sizeof(ans), LCECHO);
if(ans[0] != 'y')
return 0;
reload_money();
if(cuser.money < 49)
return 0;
if(getdata_buf(b_lines-1, 0, "請輸入新故鄉:",
- currutmp->from, 17, DOECHO)) {
+ currutmp->from, sizeof(currutmp->from), DOECHO)) {
vice(49,"home");
currutmp->from_alias=0;
}
@@ -322,7 +323,7 @@ int p_exmail() {
sprintf(buf,"您曾增購 %d 封容量,還要再買多少?",
cuser.exmailbox);
- getdata_str(b_lines-2, 0, buf, ans, 3, LCECHO, "10");
+ getdata_str(b_lines-2, 0, buf, ans, sizeof(ans), LCECHO, "10");
n = atoi(ans);
if(!ans[0] || !n)
diff --git a/mbbsd/card.c b/mbbsd/card.c
index cfa10b0c..66aeded8 100644
--- a/mbbsd/card.c
+++ b/mbbsd/card.c
@@ -1,4 +1,4 @@
-/* $Id: card.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: card.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -357,7 +357,7 @@ static int card_double_ask() {
reload_money();
if(cuser.money < JACK)
return 0;
- getdata(20, 0, buf, buf2, 2, LCECHO);
+ getdata(20, 0, buf, buf2, sizeof(buf2), LCECHO);
if(buf2[0] == 'y' || buf2[0] == 'Y')
return 1;
return 0;
@@ -368,7 +368,7 @@ static int card_ask() {
sprintf(buf, "[ %s ]您現在共有 %d P幣, 還要加牌嗎? [y/N]",
cuser.userid, cuser.money);
- getdata(20, 0 , buf, buf2, 2, LCECHO);
+ getdata(20, 0 , buf, buf2, sizeof(buf2), LCECHO);
if(buf2[0] == 'y' || buf2[0] == 'Y')
return 1;
return 0;
diff --git a/mbbsd/chat.c b/mbbsd/chat.c
index f75383a8..4825379b 100644
--- a/mbbsd/chat.c
+++ b/mbbsd/chat.c
@@ -1,4 +1,4 @@
-/* $Id: chat.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: chat.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -594,7 +594,7 @@ int t_chat() {
fclose(flog);
more(fpath, NA);
getdata(b_lines - 1, 0, "清除(C) 移至備忘錄(M) (C/M)?[C]",
- ans, 4, LCECHO);
+ ans, sizeof(ans), LCECHO);
if (*ans == 'm') {
fileheader_t mymail;
char title[128];
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c
index f789925f..f13b68dc 100644
--- a/mbbsd/chicken.c
+++ b/mbbsd/chicken.c
@@ -1,4 +1,4 @@
-/* $Id: chicken.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: chicken.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -137,7 +137,8 @@ static int new_chicken() {
}
vice(price,"寵物蛋");
while(strlen(mychicken->name)<3)
- getdata(8, 0, "幫牠取個好名字:", mychicken->name, 18, DOECHO);
+ getdata(8, 0, "幫牠取個好名字:", mychicken->name,
+ sizeof(mychicken->name), DOECHO);
now = time(NULL);
sprintf(buf,"\033[31m%s \033[m養了一隻叫\033[33m %s \033[m的 "
@@ -367,7 +368,8 @@ void ch_buyitem(int money, char *picture, int *item) {
int num = 0;
char buf[5];
- getdata_str(b_lines - 1, 0, "要買多少份呢:", buf, 4, DOECHO, "1");
+ getdata_str(b_lines - 1, 0, "要買多少份呢:",
+ buf, sizeof(buf), DOECHO, "1");
num = atoi(buf);
if(num < 1)
return;
@@ -414,7 +416,7 @@ static void ch_kill() {
sprintf(buf, "棄養這%s要被罰 100 元, 是否要棄養?(y/N)",
chicken_type[(int)mychicken->type]);
- getdata_str(23, 0, buf, ans, 3, DOECHO, "N");
+ getdata_str(23, 0, buf, ans, sizeof(ans), DOECHO, "N");
if(ans[0] == 'y') {
time_t now = time(NULL);
@@ -476,7 +478,7 @@ static int ch_sell() {
sprintf(buf, "這隻%d歲%s可以賣 %d 元, 是否要賣?(y/N)", age,
chicken_type[(int)mychicken->type], money);
- getdata_str(23, 0, buf, ans, 3, DOECHO, "N");
+ getdata_str(23, 0, buf, ans, sizeof(ans), DOECHO, "N");
if(ans[0]=='y') {
sprintf(buf, "\033[31m%s\033[m 把 \033[33m%s\033[m "
"\033[32m%s\033[m 用 \033[36m%d\033[m 賣了 於 %s",
diff --git a/mbbsd/dice.c b/mbbsd/dice.c
index d64ce63c..e4aa8869 100644
--- a/mbbsd/dice.c
+++ b/mbbsd/dice.c
@@ -1,4 +1,4 @@
-/* $Id: dice.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: dice.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -351,7 +351,7 @@ int dice_main(void) {
if(cuser.money < 10)
break;
getdata(21, 0, "\033[1;32m賭多少錢呢\033[1;37m(大於10 小於500)"
- "\033[m: ", input, 9, LCECHO);
+ "\033[m: ", input, sizeof(input), LCECHO);
if(!(money = IsLegal(input))||input[0] == '0')
continue;
reload_money();
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 0b372209..79ecf7f6 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1,4 +1,4 @@
-/* $Id: edit.c,v 1.4 2002/04/27 15:50:17 in2 Exp $ */
+/* $Id: edit.c,v 1.5 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -502,7 +502,7 @@ static void read_tmpbuf(int n) {
setuserfile(fp_tmpbuf, tmpf);
if(n != 0 && n != 5 && more(fp_tmpbuf, NA) != -1)
- getdata(b_lines - 1, 0, "確定讀入嗎(Y/N)?[Y]", ans, 4, LCECHO);
+ getdata(b_lines - 1, 0, "確定讀入嗎(Y/N)?[Y]", ans, sizeof(ans), LCECHO);
if(*ans != 'n' && (fp = fopen(fp_tmpbuf, "r"))) {
prevln = currln;
prevpnt = currpnt;
@@ -523,7 +523,7 @@ static void write_tmpbuf() {
if(dashf(fp_tmpbuf)) {
more(fp_tmpbuf, NA);
getdata(b_lines - 1, 0, "暫存檔已有資料 (A)附加 (W)覆寫 (Q)取消?[A] ",
- ans, 4, LCECHO);
+ ans, sizeof(ans), LCECHO);
if(ans[0] == 'q')
return;
@@ -544,7 +544,8 @@ static void erase_tmpbuf() {
setuserfile(fp_tmpbuf, ask_tmpbuf(3));
if(more(fp_tmpbuf, NA) != -1)
- getdata(b_lines - 1, 0, "確定刪除嗎(Y/N)?[N]", ans, 4, LCECHO);
+ getdata(b_lines - 1, 0, "確定刪除嗎(Y/N)?[N]",
+ ans, sizeof(ans), LCECHO);
if(*ans == 'y')
unlink(fp_tmpbuf);
}
@@ -706,7 +707,8 @@ static int check_quote() {
{
char ans[4];
- getdata(12, 12, "(E)繼續編輯 (W)強制寫入?[E] ", ans, 4, LCECHO);
+ getdata(12, 12, "(E)繼續編輯 (W)強制寫入?[E] ",
+ ans, sizeof(ans), LCECHO);
if(ans[0] == 'w')
return 0;
}
@@ -760,10 +762,10 @@ void write_header(FILE *fp) {
int defanony = (currbrdattr & BRD_DEFAULTANONYMOUS);
if(defanony)
getdata(3, 0, "請輸入你想用的ID,也可直接按[Enter],"
- "或是按[r]用真名:", real_name, 12, DOECHO);
+ "或是按[r]用真名:", real_name, sizeof(real_name), DOECHO);
else
getdata(3, 0, "請輸入你想用的ID,也可直接按[Enter]使用原ID:",
- real_name, 12, DOECHO);
+ real_name, sizeof(real_name), DOECHO);
if(!real_name[0] && defanony) {
strcpy(real_name, "Anonymous");
strcpy(postlog.author, real_name);
@@ -893,7 +895,7 @@ write_file(char *fpath, int saveheader, int *islocal) {
else
msg = "[S]儲存 (L)站內信件 (A)放棄 (T)改標題 (E)繼續 "
"(R/W/D)讀寫刪暫存檔?";
- getdata(1, 0, msg, ans, 3, LCECHO);
+ getdata(1, 0, msg, ans, 2, LCECHO);
switch(ans[0]) {
case 'a':
@@ -915,7 +917,7 @@ write_file(char *fpath, int saveheader, int *islocal) {
move(3, 0);
prints("舊標題:%s", save_title);
strcpy(ans,save_title);
- if(getdata_buf(4, 0, "新標題:", ans, TTLEN, DOECHO))
+ if(getdata_buf(4, 0, "新標題:", ans, sizeof(ans), DOECHO))
strcpy(save_title, ans);
return KEEP_EDITING;
case 's':
@@ -1094,7 +1096,7 @@ static void goto_line(int lino) {
char buf[10];
if(lino > 0 ||
- (getdata(b_lines - 1, 0, "跳至第幾行:", buf, 10, DOECHO) &&
+ (getdata(b_lines - 1, 0, "跳至第幾行:", buf, sizeof(buf), DOECHO) &&
sscanf(buf, "%d", &lino) && lino > 0)) {
textline_t* p;
@@ -1148,16 +1150,17 @@ char *strcasestr(const char* big, const char* little) {
-1: backward
*/
static void search_str(int mode) {
- static char str[80];
+ static char str[65];
typedef char* (*FPTR)();
static FPTR fptr;
char ans[4] = "n";
if(!mode) {
- if(getdata_buf(b_lines - 1, 0,"[搜尋]關鍵字:",str, 65, DOECHO))
+ if(getdata_buf(b_lines - 1, 0,"[搜尋]關鍵字:",
+ str, sizeof(str), DOECHO))
if(*str) {
if(getdata(b_lines - 1, 0, "區分大小寫(Y/N/Q)? [N] ",
- ans, 4, LCECHO) && *ans == 'y')
+ ans, sizeof(ans), LCECHO) && *ans == 'y')
fptr = strstr;
else
fptr = strcasestr;
@@ -1351,7 +1354,7 @@ static void block_del(int hide) {
if(tmpfname[4] != '5' && dashf(fp_tmpbuf)) {
more(fp_tmpbuf, NA);
getdata(b_lines - 1, 0, "暫存檔已有資料 (A)附加 (W)覆寫 "
- "(Q)取消?[W] ", ans, 4, LCECHO);
+ "(Q)取消?[W] ", ans, 2, LCECHO);
if(*ans == 'q')
tmpfname[4] = 'q';
else if(*ans != 'a')
@@ -1752,7 +1755,7 @@ int vedit(char *fpath, int saveheader, int *islocal) {
"\033[45mP\033[46mC\033[47mW\033[m");
if(getdata(b_lines - 1, 0,
"請輸入 亮度/前景/背景[正常白字黑底][0wb]:",
- ans, 4, LCECHO)) {
+ ans, sizeof(ans), LCECHO)) {
char t[] = "BRGYLPCW";
char color[15];
char *tmp, *apos = ans;
@@ -2112,7 +2115,7 @@ int vedit(char *fpath, int saveheader, int *islocal) {
getdata(b_lines - 1, 0,
"區塊微調右移插入字元(預設為空白字元)",
- ans, 4, LCECHO);
+ ans, sizeof(ans), LCECHO);
insert_c = (*ans) ? *ans : ' ';
}
insert_character ^= 1;
diff --git a/mbbsd/friend.c b/mbbsd/friend.c
index fef3fabc..bac0674e 100644
--- a/mbbsd/friend.c
+++ b/mbbsd/friend.c
@@ -1,4 +1,4 @@
-/* $Id: friend.c,v 1.4 2002/04/09 20:31:50 in2 Exp $ */
+/* $Id: friend.c,v 1.5 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -124,7 +124,7 @@ void friend_add(char *uident, int type) {
strcpy(t_uident, uident);
if (type != FRIEND_ALOHA && type != FRIEND_POST)
- getdata(2, 0, friend_desc[type], buf, 40, DOECHO);
+ getdata(2, 0, friend_desc[type], buf, sizeof(buf), DOECHO);
if ((fp = fopen(fpath, "a")))
{
@@ -445,12 +445,13 @@ void friend_edit(int type) {
}
else if (*uident == 'w' && count)
{
- if (!getdata(0, 0, "群體水球:", uident, 60, DOECHO))
+ char wall[60];
+ if (!getdata(0, 0, "群體水球:", uident, sizeof(wall), DOECHO))
continue;
if (getdata(0, 0, "確定丟出群體水球? [Y]", line, 4, LCECHO) &&
*line == 'n')
continue;
- friend_water(uident, type);
+ friend_water(wall, type);
}
else
break;
diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c
index 06062ce4..41650c77 100644
--- a/mbbsd/gomo.c
+++ b/mbbsd/gomo.c
@@ -1,4 +1,4 @@
-/* $Id: gomo.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: gomo.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -131,7 +131,7 @@ static int gomo_key(int fd, int ch, Horder_t *mv) {
*pbuf = ch;
if(fd)
add_io(0, 0);
- oldgetdata(17, 0, "直接指定位置 :", pbuf, 4, DOECHO);
+ oldgetdata(17, 0, "直接指定位置 :", pbuf, sizeof(pbuf), DOECHO);
if(fd)
add_io(fd, 0);
vx = pbuf[0] - 'a';
@@ -409,7 +409,7 @@ int gomoku(int fd) {
if(v > pool) {
char ans[4];
- getdata(19 , 0, "要保留本局成棋譜嗎?(y/N)", ans, 4, LCECHO);
+ getdata(19 , 0, "要保留本局成棋譜嗎?(y/N)", ans, sizeof(ans), LCECHO);
if(*ans == 'y')
HO_log(my->mateid);
}
diff --git a/mbbsd/guess.c b/mbbsd/guess.c
index 27a337f7..c24b8361 100644
--- a/mbbsd/guess.c
+++ b/mbbsd/guess.c
@@ -1,4 +1,4 @@
-/* $Id: guess.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: guess.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -84,7 +84,7 @@ static int check_data(char *str) {
static char *get_data(int count) {
static char data[5];
while(1) {
- getdata(6, 0, "輸入四位數字(不重複): ", data, 5, LCECHO);
+ getdata(6, 0, "輸入四位數字(不重複): ", data, sizeof(data), LCECHO);
if(check_data(data) == 1)
break;
}
@@ -209,7 +209,7 @@ int guess_main() {
unsigned long int money;
char computerwin = 0,youwin = 0;
int count = 0,c_count = 0;
- char ifcomputer;
+ char ifcomputer[2];
char answer[5];
int *n = NULL;
char yournum[5];
@@ -239,18 +239,19 @@ int guess_main() {
clrtoeol();
prints("您下注 :%d Ptt$", money);
- getdata_str(4, 0, "您要和電腦比賽嗎? <y/n>[y]:", &ifcomputer, 2,
- LCECHO, "y");
- if(ifcomputer == 'y') {
- ifcomputer = 1;
+ getdata_str(4, 0, "您要和電腦比賽嗎? <y/n>[y]:",
+ ifcomputer, sizeof(ifcomputer), LCECHO, "y");
+ if(ifcomputer[0] == 'y') {
+ ifcomputer[0] = 1;
show_table(TABLE, 1);
} else {
- ifcomputer = 0;
+ ifcomputer[0] = 0;
show_table(TABLE, 0);
}
- if(ifcomputer) {
+ if(ifcomputer[0]) {
do {
- getdata(5, 0, "請輸入您要讓電腦猜的數字: ", yournum, 5, LCECHO);
+ getdata(5, 0, "請輸入您要讓電腦猜的數字: ",
+ yournum, sizeof(yournum), LCECHO);
} while(!legal(atoi(yournum)));
move(8, 25);
prints("電腦猜");
@@ -260,9 +261,9 @@ int guess_main() {
}
move(8, 55);
prints("你猜");
- while(((!computerwin || !youwin) && count <10 && (ifcomputer)) ||
- (!ifcomputer && count < 10 && !youwin)) {
- if(!computerwin && ifcomputer) {
+ while(((!computerwin || !youwin) && count <10 && (ifcomputer[0])) ||
+ (!ifcomputer[0] && count < 10 && !youwin)) {
+ if(!computerwin && ifcomputer[0]) {
++c_count;
if(computer(atoi(yournum), c_count, flag, n))
computerwin = 1;
@@ -276,7 +277,7 @@ int guess_main() {
}
}
move(17, 35);
- if(ifcomputer) {
+ if(ifcomputer[0]) {
free(flag);
free(n);
if(count > c_count) {
diff --git a/mbbsd/indict.c b/mbbsd/indict.c
index 407b5ae9..51e20590 100644
--- a/mbbsd/indict.c
+++ b/mbbsd/indict.c
@@ -1,4 +1,4 @@
-/* $Id: indict.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: indict.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@@ -29,7 +29,7 @@ static void addword(char word[]) {
outs("\n請依上列範例輸入一行資料(直接enter放棄)\n");
getdata(10, 0, ":", buf, 65, DOECHO);
if(buf[0]) {
- getdata(13, 0, "確定新增?(Y/n)", a, 2, LCECHO);
+ getdata(13, 0, "確定新增?(Y/n)", a, sizeof(a), LCECHO);
if(a[0] != 'n')
fprintf(fp, "%-65s[%s]\n", buf, cuser.userid);
}
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 4bfd80cc..79a3874f 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -1,4 +1,4 @@
-/* $Id: io.c,v 1.8 2002/03/29 16:22:53 ptt Exp $ */
+/* $Id: io.c,v 1.9 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -547,14 +547,14 @@ getans(char *prompt)
{
char ans[5];
- getdata(t_lines-1, 0, prompt, ans, 4, LCECHO);
+ getdata(t_lines-1, 0, prompt, ans, sizeof(ans), LCECHO);
return ans[0];
}
int getdata_str(int line, int col, char *prompt, char *buf, int len, int echo, char *defaultstr) {
strncpy(buf, defaultstr, len);
- buf[len] = 0;
+ buf[len - 1] = 0;
return oldgetdata(line, col, prompt, buf, len, echo);
}
diff --git a/mbbsd/lovepaper.c b/mbbsd/lovepaper.c
index 52e8cbd5..92330db7 100644
--- a/mbbsd/lovepaper.c
+++ b/mbbsd/lovepaper.c
@@ -1,4 +1,4 @@
-/* $Id: lovepaper.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: lovepaper.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -36,10 +36,11 @@ int x_love() {
outs("\n歡迎使用情書產生器 v0.00 版 \n");
outs("有何難以啟齒的話,交由系統幫你說吧.\n爸爸說 : 濫情不犯法.\n");
- if(!getdata(7, 0, "收信人:", receiver, 60, DOECHO)) return 0;
+ if(!getdata(7, 0, "收信人:", receiver, sizeof(receiver), DOECHO))
+ return 0;
if(receiver[0] && !(searchuser(receiver) &&
getdata(8, 0, "主 題:", save_title,
- TTLEN, DOECHO))) {
+ sizeof(save_title), DOECHO))) {
move(10, 0);
outs("收信人或主題不正確, 情書無法傳遞. ");
pressanykey();
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 4a9395fa..bc6ff7b3 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -1,4 +1,4 @@
-/* $Id: mail.c,v 1.2 2002/03/24 18:25:48 in2 Exp $ */
+/* $Id: mail.c,v 1.3 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -61,9 +61,9 @@ int setforward() {
fclose(fp);
}
getdata_buf(b_lines - 1, 0, "請輸入信箱自動轉寄的email地址:",
- ip, 41, DOECHO);
+ ip, sizeof(ip), DOECHO);
if(ip[0] && ip[0] != ' ') {
- getdata(b_lines, 0, "確定開啟自動轉信功\能?(Y/n)", yn, 3,
+ getdata(b_lines, 0, "確定開啟自動轉信功\能?(Y/n)", yn, sizeof(yn),
LCECHO);
if(yn[0] != 'n' && (fp = fopen(buf, "w"))) {
move(b_lines,0);
@@ -149,9 +149,9 @@ int invalidaddr(char *addr) {
int m_internet() {
char receiver[60];
- getdata(20, 0, "收信人:", receiver, 60, DOECHO);
+ getdata(20, 0, "收信人:", receiver, sizeof(receiver), DOECHO);
if(strchr(receiver, '@') && !invalidaddr(receiver) &&
- getdata(21, 0, "主 題:", save_title, TTLEN, DOECHO))
+ getdata(21, 0, "主 題:", save_title, STRLEN, DOECHO))
do_send(receiver, save_title);
else {
move(22, 0);
@@ -245,7 +245,7 @@ void hold_mail(char *fpath, char *receiver) {
char buf[4];
getdata(b_lines - 1, 0, "已順利寄出,是否自存底稿(Y/N)?[N] ",
- buf, 4, LCECHO);
+ buf, sizeof(buf), LCECHO);
if(buf[0] == 'y')
do_hold_mail(fpath, receiver, cuser.userid);
@@ -268,7 +268,7 @@ int do_send(char *userid, char *title) {
return -3;
if(!title)
- getdata(2, 0, "主題:", save_title, TTLEN, DOECHO);
+ getdata(2, 0, "主題:", save_title, STRLEN, DOECHO);
curredit |= EDIT_MAIL;
curredit &= ~EDIT_ITEM;
}
@@ -485,7 +485,7 @@ static void multi_send(char *title) {
if(title)
do_reply_title(2, title);
else {
- getdata(2, 0, "主題:", fpath, 64, DOECHO);
+ getdata(2, 0, "主題:", fpath, sizeof(fpath), DOECHO);
sprintf(save_title, "[通告] %s", fpath);
}
@@ -588,7 +588,7 @@ int mail_all() {
stand_title("給所有使用者的系統通告");
setutmpmode(SMAIL);
- getdata(2, 0, "主題:", fpath, 64, DOECHO);
+ getdata(2, 0, "主題:", fpath, sizeof(fpath), DOECHO);
sprintf(save_title, "[系統通告]\033[1;32m %s\033[m", fpath);
setuserfile(fpath, fn_notes);
@@ -1139,7 +1139,7 @@ static int mail_cross_post(int ent, fileheader_t *fhdr, char *direct) {
strcpy(xtitle, fhdr->title);
sprintf(genbuf, "採用原標題《%.60s》嗎?[Y] ", xtitle);
- getdata(2, 0, genbuf, genbuf2, 4, LCECHO);
+ getdata(2, 0, genbuf, genbuf2, sizeof(genbuf2), LCECHO);
if(*genbuf2 == 'n')
if(getdata(2, 0, "標題:", genbuf, TTLEN, DOECHO))
strcpy(xtitle, genbuf);
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index e7a2f84d..496ea00f 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.23 2002/04/28 14:29:26 in2 Exp $ */
+/* $Id: mbbsd.c,v 1.24 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -601,7 +601,7 @@ login_query ()
exit (1);
}
getdata (20, 0, "請輸入代號,或以[guest]參觀,以[new]註冊:",
- uid, IDLEN + 1, DOECHO);
+ uid, sizeof(uid), DOECHO);
if (strcasecmp (uid, str_new) == 0){
#ifdef LOGINASNEW
new_register ();
@@ -615,7 +615,7 @@ login_query ()
outs (err_uid);
}
else if (strcmp (uid, STR_GUEST)){
- getdata (21, 0, MSG_PASSWD, passbuf, PASSLEN, NOECHO);
+ getdata (21, 0, MSG_PASSWD, passbuf, sizeof(passbuf), NOECHO);
passbuf[8] = '\0';
if (!checkpasswd (cuser.passwd, passbuf)
diff --git a/mbbsd/more.c b/mbbsd/more.c
index 7440ecc4..f8d32c61 100644
--- a/mbbsd/more.c
+++ b/mbbsd/more.c
@@ -1,4 +1,4 @@
-/* $Id: more.c,v 1.11 2002/04/27 15:50:17 in2 Exp $ */
+/* $Id: more.c,v 1.12 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -459,7 +459,7 @@ int more(char *fpath, int promptend) {
if(*search_str) {
searching = 1;
if(getdata(b_lines - 1, 0, "區分大小寫(Y/N/Q)? [N] ",
- ans, 4, LCECHO) && *ans == 'y')
+ ans, sizeof(ans), LCECHO) && *ans == 'y')
fptr = strstr;
else
fptr = strcasestr;
diff --git a/mbbsd/othello.c b/mbbsd/othello.c
index 47b8cef3..888a483e 100644
--- a/mbbsd/othello.c
+++ b/mbbsd/othello.c
@@ -1,4 +1,4 @@
-/* $Id: othello.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: othello.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -485,7 +485,8 @@ static int choose() {
prints("(2) 嬰兒\n"); /* 想 3 步 */
prints("(3) 小孩\n"); /* 想 4 步 */
do {
- getdata(4, 0, "請選擇一個對象和您對打:(1~5)", thinkstep, 2, LCECHO);
+ getdata(4, 0, "請選擇一個對象和您對打:(1~5)",
+ thinkstep, sizeof(thinkstep), LCECHO);
} while(thinkstep[0] < '1' || thinkstep[0] > '3');
clear();
switch(thinkstep[0]) {
diff --git a/mbbsd/page.c b/mbbsd/page.c
index 33201bfc..5be7762e 100644
--- a/mbbsd/page.c
+++ b/mbbsd/page.c
@@ -1,4 +1,4 @@
-/* $Id: page.c,v 1.2 2002/04/27 15:50:17 in2 Exp $ */
+/* $Id: page.c,v 1.3 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -103,7 +103,7 @@ int main_railway() {
break;
while(1)
if(getdata(21, 0, "\033[1;35m欲查詢 1:出發時間 2:到達時間\033[m",
- tt, 2, LCECHO) &&
+ tt, sizeof(tt), LCECHO) &&
(tt[0]=='1' || tt[0]=='2'))
break;
sethomepath(genbuf, cuser.userid);
diff --git a/mbbsd/read.c b/mbbsd/read.c
index b92f95e7..b2cc64a4 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: read.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@@ -408,7 +408,7 @@ static int thread(keeploc_t *locmem, int stype) {
}
sprintf(s_pmt, "%s搜尋%s [%s] ",(stype & RS_FORWARD) ? "往後":"往前",
(stype & RS_TITLE) ? "標題" : "作者", query);
- getdata(b_lines - 1, 0, s_pmt, ans, 30, DOECHO);
+ getdata(b_lines - 1, 0, s_pmt, ans, sizeof(ans), DOECHO);
if(*ans)
strcpy(query, ans);
else if(*query == '\0')
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 1ef56e9e..53acc82f 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -1,4 +1,4 @@
-/* $Id: register.c,v 1.2 2002/03/17 06:04:18 in2 Exp $ */
+/* $Id: register.c,v 1.3 2002/04/28 19:35:29 in2 Exp $ */
#define _XOPEN_SOURCE
#include <stdio.h>
@@ -217,7 +217,8 @@ void new_register() {
oflush();
exit(1);
}
- getdata(17, 0, msg_uid, newuser.userid, IDLEN + 1, DOECHO);
+ getdata(17, 0, msg_uid, newuser.userid,
+ sizeof(newuser.userid), DOECHO);
if(bad_user_id(newuser.userid))
outs("無法接受這個代號,請使用英文字母,並且不要包含空格\n");
@@ -246,13 +247,14 @@ void new_register() {
oflush();
exit(1);
}
- if((getdata(19, 0, "請設定密碼:", passbuf, PASSLEN, NOECHO) < 3) ||
+ if((getdata(19, 0, "請設定密碼:", passbuf,
+ sizeof(passbuf), NOECHO) < 3) ||
!strcmp(passbuf, newuser.userid)) {
outs("密碼太簡單,易遭入侵,至少要 4 個字,請重新輸入\n");
continue;
}
strncpy(newuser.passwd, passbuf, PASSLEN);
- getdata(20, 0, "請檢查密碼:", passbuf, PASSLEN, NOECHO);
+ getdata(20, 0, "請檢查密碼:", passbuf, sizeof(passbuf), NOECHO);
if(strncmp(passbuf, newuser.passwd, PASSLEN)) {
outs("密碼輸入錯誤, 請重新輸入密碼.\n");
continue;
@@ -291,33 +293,37 @@ void check_register() {
stand_title("請詳細填寫個人資料");
while(strlen(cuser.username) < 2)
- getdata(2, 0, "綽號暱稱:", cuser.username, 24, DOECHO);
+ getdata(2, 0, "綽號暱稱:", cuser.username,
+ sizeof(cuser.username), DOECHO);
for(ptr = cuser.username; *ptr; ptr++) {
if (*ptr == 9) /* TAB convert */
*ptr = ' ';
}
while(strlen(cuser.realname) < 4)
- getdata(4, 0, "真實姓名:", cuser.realname, 20, DOECHO);
+ getdata(4, 0, "真實姓名:", cuser.realname,
+ sizeof(cuser.realname), DOECHO);
while(strlen(cuser.address) < 8)
- getdata(6, 0, "聯絡地址:", cuser.address, 50, DOECHO);
+ getdata(6, 0, "聯絡地址:", cuser.address,
+ sizeof(cuser.address), DOECHO);
/*
if(!strchr(cuser.email, '@')) {
bell();
move(t_lines - 4, 0);
- prints("※ 為了您的權益,請填寫真實的 E-mail address, "
+ prints("※ 為了您的權益,請填寫真實的 E-mail address,"
"以資確認閣下身份,\n"
"格式為 \033[44muser@domain_name\033[0m 或 \033[44muser"
"@\\[ip_number\\]\033[0m。\n\n"
"※ 如果您真的沒有 E-mail,請直接按 [return] 即可。");
do {
- getdata(8, 0, "電子信箱:", cuser.email, 50, DOECHO);
+ getdata(8, 0, "電子信箱:",
+ cuser.email, sizeof(cuser.email), DOECHO);
if(!cuser.email[0])
- sprintf(cuser.email, "%s%s", cuser.userid, str_mail_address);
+ sprintf(cuser.email, "%s%s", cuser.userid, str_mail_address);
} while(!strchr(cuser.email, '@'));
}
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c
index 67edc632..474e8b65 100644
--- a/mbbsd/syspost.c
+++ b/mbbsd/syspost.c
@@ -1,4 +1,4 @@
-/* $Id: syspost.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
+/* $Id: syspost.c,v 1.3 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <time.h>
@@ -41,7 +41,7 @@ void post_change_perm(int oldperm, int newperm, char *sysopid, char *userid) {
clrtobot();
clear();
while(!getdata_str(5, 0, "請輸入理由以示負責:",
- reason, 60, DOECHO, "看版版主:"));
+ reason, sizeof(reason), DOECHO, "看版版主:"));
fprintf(fp, "\n \033[1;37m站長%s修改權限理由是:%s\033[m",
cuser.userid, reason);
fclose(fp);
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 73fdbc43..463f1f71 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,4 +1,4 @@
-/* $Id: talk.c,v 1.22 2002/04/27 15:50:17 in2 Exp $ */
+/* $Id: talk.c,v 1.23 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -819,7 +819,7 @@ int t_display(void)
setuserfile(genbuf, fn_writelog);
if (more(genbuf, YEA) != -1){
getdata(b_lines - 1, 0, "清除(C) 移至備忘錄(M) 保留(R) (C/M/R)?[R]",
- ans, 3, LCECHO);
+ ans, sizeof(ans), LCECHO);
if (*ans == 'm'){
fileheader_t mymail;
char title[128], buf[80];
@@ -1108,7 +1108,7 @@ static void do_talk(int fd)
fclose(flog);
more(fpath, NA);
getdata(b_lines - 1, 0, "清除(C) 移至備忘錄(M). (C/M)?[C]",
- ans, 4, LCECHO);
+ ans, sizeof(ans), LCECHO);
if (*ans == 'm'){
fileheader_t mymail;
char title[128];
@@ -1838,8 +1838,8 @@ static void pickup_user(void)
char buf[100];
sprintf(buf, "代號 [%s]:", currutmp->userid);
- if (!getdata(1, 0, buf, currutmp->userid, IDLEN + 1,
- DOECHO))
+ if (!getdata(1, 0, buf, currutmp->userid,
+ sizeof(currutmp->userid), DOECHO))
strcpy(currutmp->userid, cuser.userid);
state = US_REDRAW;
}
@@ -1849,7 +1849,8 @@ static void pickup_user(void)
char buf[100];
sprintf(buf, "故鄉 [%s]:", currutmp->from);
- if (!getdata(1, 0, buf, currutmp->from, 17, DOECHO))
+ if (!getdata(1, 0, buf, currutmp->from,
+ sizeof(currutmp->from), DOECHO))
strncpy(currutmp->from, fromhost, 23);
state = US_REDRAW;
}
@@ -1903,8 +1904,8 @@ static void pickup_user(void)
break;
case '/':
- getdata_buf(b_lines-1,0,"請輸入暱稱關鍵字:",keyword, 12,
- DOECHO);
+ getdata_buf(b_lines-1,0,"請輸入暱稱關鍵字:",
+ keyword, sizeof(keyword), DOECHO);
state = US_PICKUP;
break;
case 's':
@@ -1966,7 +1967,8 @@ static void pickup_user(void)
state = US_PICKUP;
if (!getdata(0, 0, "廣播訊息:", genbuf, 60, DOECHO))
break;
- if (getdata(0, 0, "確定廣播? [Y]", ans, 4, LCECHO) &&
+ if (getdata(0, 0, "確定廣播? [Y]",
+ ans, sizeof(ans), LCECHO) &&
*ans == 'n')
break;
while (actor_pos){
@@ -2247,8 +2249,8 @@ int t_idle(void)
if (currutmp->destuid == 6)
if (!cuser.userlevel ||
- !getdata(b_lines - 1, 0, "發呆的理由:", currutmp->chatid, 11,
- DOECHO))
+ !getdata(b_lines - 1, 0, "發呆的理由:",
+ currutmp->chatid, sizeof(currutmp->chatid), DOECHO))
currutmp->destuid = 0;
do{
move(b_lines - 2, 0);
@@ -2257,7 +2259,7 @@ int t_idle(void)
IdleTypeTable[currutmp->destuid] : currutmp->chatid);
outs(buf);
refresh();
- getdata(b_lines - 1, 0, MSG_PASSWD, passbuf, PASSLEN, NOECHO);
+ getdata(b_lines - 1, 0, MSG_PASSWD, passbuf, sizeof(passbuf), NOECHO);
passbuf[8] = '\0';
}
while (!checkpasswd(cuser.passwd, passbuf) &&
@@ -2379,11 +2381,11 @@ void talkreply(void)
sprintf(genbuf, "你想跟 %s %s啊?請選擇(Y/N/A/B/C/D/E/F/1/2)[N] ",
page_requestor, sig_des[sig]);
- getdata(0, 0, genbuf, buf, 4, LCECHO);
+ getdata(0, 0, genbuf, buf, sizeof(buf), LCECHO);
if (uip->mode != PAGE){
sprintf(genbuf, "%s已停止呼叫,按Enter繼續...", page_requestor);
- getdata(0, 0, genbuf, buf, 4, LCECHO);
+ getdata(0, 0, genbuf, buf, sizeof(buf), LCECHO);
return;
}
currutmp->msgcount = 0;
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 55719a4a..3cce4bc5 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1,4 +1,4 @@
-/* $Id: user.c,v 1.14 2002/04/27 15:50:17 in2 Exp $ */
+/* $Id: user.c,v 1.15 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -50,7 +50,7 @@ int u_loginview() {
clrtobot();
while(getdata(b_lines - 1, 0, "請按 [A-N] 切換設定,按 [Return] 結束:",
- choice, 3, LCECHO)) {
+ choice, sizeof(choice), LCECHO)) {
i = choice[0] - 'a';
if(i >= NUMVIEWFILE || i < 0)
bell();
@@ -175,8 +175,7 @@ static void violate_law(userec_t *u, int unum){
move(2,0);
prints("(1)Cross-post (2)亂發廣告信 (3)亂發連鎖信\n");
prints("(4)騷擾站上使用者 (8)其他以罰單處置行為\n(9)砍 id 行為\n");
- getdata(5, 0, "(0)結束",
- ans, 3, DOECHO);
+ getdata(5, 0, "(0)結束", ans, sizeof(ans), DOECHO);
switch(ans[0]){
case '1':
sprintf(reason, "%s", "Cross-post");
@@ -193,12 +192,12 @@ static void violate_law(userec_t *u, int unum){
break;
case '8':
case '9':
- while(!getdata(6, 0, "請輸入理由以示負責:", reason, 50, DOECHO));
+ while(!getdata(6, 0, "請輸入理由以示負責:", reason, 50, DOECHO));
break;
default:
return;
}
- getdata(7, 0, msg_sure_ny, ans2, 3, LCECHO);
+ getdata(7, 0, msg_sure_ny, ans2, sizeof(ans2), LCECHO);
if(*ans2 != 'y')
return;
if (ans[0]=='9'){
@@ -243,7 +242,7 @@ void uinfo_query(userec_t *u, int real, int unum) {
"(1)改資料(2)設密碼(3)設權限(4)砍帳號(5)改ID"
"(6)殺/復活寵物(7)審判 [0]結束 " :
"請選擇 (1)修改資料 (2)設定密碼 ==> [0]結束 ",
- ans, 3, DOECHO);
+ ans, sizeof(ans), DOECHO);
if(ans[0] > '2' && !real)
ans[0] = '0';
@@ -264,11 +263,15 @@ void uinfo_query(userec_t *u, int real, int unum) {
move(0, 0);
outs("請逐項修改。");
- getdata_buf(i++, 0," 暱 稱 :",x.username, 24, DOECHO);
+ getdata_buf(i++, 0," 暱 稱 :",x.username,
+ sizeof(x.username), DOECHO);
if(real) {
- getdata_buf(i++, 0, "真實姓名:", x.realname, 20, DOECHO);
- getdata_buf(i++, 0, "身分證號:", x.ident, 11, DOECHO);
- getdata_buf(i++, 0, "居住地址:", x.address, 50, DOECHO);
+ getdata_buf(i++, 0, "真實姓名:",
+ x.realname, sizeof(x.realname), DOECHO);
+ getdata_buf(i++, 0, "身分證號:",
+ x.ident, sizeof(x.ident), DOECHO);
+ getdata_buf(i++, 0, "居住地址:",
+ x.address, sizeof(x.address), DOECHO);
}
sprintf(buf, "%010d", x.mobile);
getdata_buf(i++, 0, "手機號碼:", buf, 11, LCECHO);
@@ -332,11 +335,13 @@ void uinfo_query(userec_t *u, int real, int unum) {
if((l = atol(buf)) != 0)
x.exmailbox = (int)l;
- getdata_buf(i++, 0, "認證資料:", x.justify, 44, DOECHO);
- getdata_buf(i++, 0, "最近光臨機器:", x.lasthost, 16, DOECHO);
+ getdata_buf(i++, 0, "認證資料:", x.justify,
+ sizeof(x.justify), DOECHO);
+ getdata_buf(i++, 0, "最近光臨機器:",
+ x.lasthost, sizeof(x.lasthost), DOECHO);
sprintf(genbuf, "%d", x.numlogins);
- if(getdata_str(i++, 0,"上線次數:", buf, 10, DOECHO,genbuf))
+ if(getdata_str(i++, 0,"上線次數:", buf, 10, DOECHO, genbuf))
if((fail = atoi(buf)) >= 0)
x.numlogins = fail;
@@ -398,7 +403,8 @@ void uinfo_query(userec_t *u, int real, int unum) {
char witness[3][32];
time_t now = time(NULL);
for(i=0;i<3;i++){
- if(!getdata(19+i, 0, "請輸入協助證明之使用者:", witness[i], 32, DOECHO)){
+ if(!getdata(19+i, 0, "請輸入協助證明之使用者:",
+ witness[i], sizeof(witness[i]), DOECHO)){
outs("\n不輸入則無法更改\n");
fail++;
break;
@@ -534,7 +540,9 @@ void uinfo_query(userec_t *u, int real, int unum) {
clrtobot ();
clear();
- while(!getdata(5, 0, "請輸入理由以示負責:", reason, 60, DOECHO));
+ while( !getdata(5, 0, "請輸入理由以示負責:",
+ reason, sizeof(reason), DOECHO) )
+ ;
fprintf(fp, "\n \033[1;37m站長%s修改錢理由是:%s\033[m",
cuser.userid, reason);
@@ -637,7 +645,8 @@ int u_editsig() {
j = showsignature(genbuf);
- getdata(0, 0, "簽名檔 (E)編輯 (D)刪除 (Q)取消?[Q] ", ans, 4, LCECHO);
+ getdata(0, 0, "簽名檔 (E)編輯 (D)刪除 (Q)取消?[Q] ",
+ ans, sizeof(ans), LCECHO);
aborted = 0;
if(ans[0] == 'd')
@@ -646,7 +655,7 @@ int u_editsig() {
aborted = 2;
if(aborted) {
- if(!getdata(1, 0, "請選擇簽名檔(1-9)?[1] ", ans, 4, DOECHO))
+ if(!getdata(1, 0, "請選擇簽名檔(1-9)?[1] ", ans, sizeof(ans), DOECHO))
ans[0] = '1';
if(ans[0] >= '1' && ans[0] <= '9') {
genbuf[j] = ans[0];
@@ -937,7 +946,7 @@ int u_register(void)
prints("%s(%s) 您好,請輸入您的認證碼或輸入 x重填 E-Mail ",
cuser.userid, cuser.username);
inregcode[0] = 0;
- getdata(10, 0, "您的認證碼: ", inregcode, 45, DOECHO);
+ getdata(10, 0, "您的認證碼: ", inregcode, sizeof(inregcode), DOECHO);
if( strcmp(inregcode, getregcode(regcode)) == 0 ){
int unum;
if( (unum = getuser(cuser.userid)) == 0 ){
@@ -964,7 +973,8 @@ int u_register(void)
return FULLUPDATE;
}
- getdata(b_lines - 1, 0, "您確定要填寫註冊單嗎(Y/N)?[N] ", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, "您確定要填寫註冊單嗎(Y/N)?[N] ",
+ ans, sizeof(ans), LCECHO);
if(ans[0] != 'y')
return FULLUPDATE;
@@ -1017,7 +1027,7 @@ int u_register(void)
}
getfield(17, "1.葛格 2.姐接 ", "性別", sex_is, 2);
getdata(18, 0, "以上資料是否正確(Y/N)?(Q)取消註冊 [N] ",
- ans, 3, LCECHO);
+ ans, sizeof(ans), LCECHO);
if(ans[0] == 'q')
return 0;
if(ans[0] == 'y')
diff --git a/mbbsd/vice.c b/mbbsd/vice.c
index 46f695d9..a27e5b21 100644
--- a/mbbsd/vice.c
+++ b/mbbsd/vice.c
@@ -1,4 +1,4 @@
-/* $Id: vice.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: vice.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -118,7 +118,8 @@ int vice_main() {
j += 9;
j %= 45;
}
- getdata(8, 0, "按'c'開始對獎了(或是任意鍵離開)): ", ch, 2, LCECHO);
+ getdata(8, 0, "按'c'開始對獎了(或是任意鍵離開)): ",
+ ch, sizeof(ch), LCECHO);
if(ch[0] != 'c' || lockutmpmode(VICE, LOCK_MULTI)){
fclose(fd);
return 0;
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index 79176f7a..9cc55b40 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -1,4 +1,4 @@
-/* $Id: vote.c,v 1.5 2002/03/29 16:22:53 ptt Exp $ */
+/* $Id: vote.c,v 1.6 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -654,7 +654,7 @@ static int vote_maintain(char *bname) {
move(0,0);
prints("第 %d 號投票\n", x);
setbfile(buf, bname, STR_new_title);
- getdata(4, 0, "請輸入投票名稱", inbuf, 30, LCECHO);
+ getdata(4, 0, "請輸入投票名稱", inbuf, sizeof(inbuf), LCECHO);
if(inbuf[0]=='\0')
strcpy(inbuf,"不知名的");
fp = fopen(buf, "w");
@@ -706,7 +706,8 @@ static int vote_maintain(char *bname) {
num = 0;
while(!aborted) {
sprintf(buf, "%c) ", num + 'A');
- getdata((num % 15) + 2, (num / 15) * 40, buf, inbuf, 36, DOECHO);
+ getdata((num % 15) + 2, (num / 15) * 40, buf,
+ inbuf, sizeof(inbuf), DOECHO);
if(*inbuf) {
fprintf(fp, "%1c) %s\n", (num+'A'), inbuf);
num++;
@@ -866,7 +867,7 @@ static int user_vote_one(char *bname, int ind) {
vote[0] = vote[1] = '\0';
move(t_lines - 2, 0);
prints("你還可以投 %2d 票", tickets - i);
- getdata(t_lines - 4, 0, "輸入您的選擇: ", vote, 3, DOECHO);
+ getdata(t_lines - 4, 0, "輸入您的選擇: ", vote, sizeof(vote), DOECHO);
*vote = toupper(*vote);
if(vote[0] == '0' || (!vote[0] && !i)) {
outs("記的再來投喔!!");
@@ -922,7 +923,8 @@ static int user_vote_one(char *bname, int ind) {
outs("請問您對這次投票有什麼寶貴的意見?"
"最多三行,按[Enter]結束");
for(i = 0; (i < 3) &&
- getdata(7 + i, 0, ":", mycomments[i], 74,
+ getdata(7 + i, 0, ":",
+ mycomments[i], sizeof(mycomments[i]),
DOECHO); i++);
getdata(b_lines-2,0, "(S)儲存 (E)重新來過 "
"(Q)取消?[S]", buf, 3, LCECHO);
diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c
index 53034692..dbc23412 100644
--- a/mbbsd/voteboard.c
+++ b/mbbsd/voteboard.c
@@ -1,4 +1,4 @@
-/* $Id: voteboard.c,v 1.3 2002/04/17 09:23:26 in2 Exp $ */
+/* $Id: voteboard.c,v 1.4 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -24,7 +24,7 @@ extern userec_t cuser;
void do_voteboardreply(fileheader_t *fhdr){
char genbuf[1024];
- char reason[60];
+ char reason[50];
char fpath[80];
char oldfpath[80];
char opnion[10];
@@ -131,7 +131,8 @@ void do_voteboardreply(fileheader_t *fhdr){
}
}while(opnion[0] != 'y' && opnion[0] != 'n');
- if (!getdata(20, 0, "請問您與這個議題的關係或連署理由為何:", reason, 40, DOECHO)){
+ if (!getdata(20, 0, "請問您與這個議題的關係或連署理由為何:",
+ reason, sizeof(reason), DOECHO)){
flock(fd, LOCK_UN);
close(fd);
fclose(fo);
diff --git a/mbbsd/xyz.c b/mbbsd/xyz.c
index 786add30..9ddbbe3e 100644
--- a/mbbsd/xyz.c
+++ b/mbbsd/xyz.c
@@ -1,4 +1,4 @@
-/* $Id: xyz.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: xyz.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -182,8 +182,9 @@ int note() {
move(12, 0);
clrtobot();
outs("\n投五銀... 嗶... 請留言 (至多三行),按[Enter]結束");
- for(i = 0; (i < 3) && getdata(16 + i, 0, ":", myitem.buf[i], 78,
- DOECHO) && *myitem.buf[i]; i++);
+ for(i = 0; (i < 3) && getdata(16 + i, 0, ":", myitem.buf[i],
+ sizeof(myitem.buf[i]), DOECHO)
+ && *myitem.buf[i]; i++);
getdata(b_lines - 1, 0, "(S)儲存 (E)重新來過 (Q)取消?[S] ",
buf, 3, LCECHO);
@@ -424,7 +425,8 @@ static int x_archie() {
strcpy(genbuf1, buf);
sprintf(buf, BBSHOME "/tmp/archie.%s", cuser.userid);
if(dashf(buf)) {
- getdata(0, 0, "要將結果寄回信箱嗎(Y/N)?[N]", ans, 3, DOECHO,0);
+ getdata(0, 0, "要將結果寄回信箱嗎(Y/N)?[N]",
+ ans, sizeof(ans), DOECHO, 0);
if(*ans == 'y') {
fileheader_t mhdr;
char title[128], buf1[80];