summaryrefslogtreecommitdiffstats
path: root/mbbsd
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 /mbbsd
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
Diffstat (limited to 'mbbsd')
-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 ? "�п�J�ϥΪ�����r[�q��|�a�}|�m�W|�W���a�I|"
- "email|�p��id] :" : "�п�Jid :", key, 21, DOECHO);
+ "email|�p��id] :" : "�п�Jid :", 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] �����]�w�A�� [Return] �����G",
- 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, "�ݪO (E)�]�w (V)�H�k/�Ѱ� %s (D)�R�� [Q]�����H",
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, "�]�wŪ�g�v��(Y/N)�H", ans, 4, LCECHO, "N");
+ getdata_str(14, 0, "�]�wŪ�g�v��(Y/N)�H", ans, sizeof(ans), LCECHO, "N");
if(*ans == 'y') {
- getdata_str(15, 0, "���� [R]�\\Ū (P)�o���H", ans, 4, LCECHO,
+ getdata_str(15, 0, "���� [R]�\\Ū (P)�o���H", ans, sizeof(ans), LCECHO,
"R");
if(*ans == 'p')
newbh.brdattr |= BRD_POSTMASK;
@@ -419,7 +419,7 @@ int x_file() {
"(X)�R���i���e��"
#endif
"\n");
- getdata(b_lines - 1, 0, " (H)�ݪO���� (I)�G�m (J)�X���e�� (K)�ͤ�d (L)�`�� [Q]�����H", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, " (H)�ݪO���� (I)�G�m (J)�X���e�� (K)�ͤ�d (L)�`�� [Q]�����H", 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, "�ĴX�Ӷi���e��[0-4]", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, "�ĴX�Ӷi���e��[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, "�ĴX�Ӷi���e��[1-4]", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, "�ĴX�Ӷi���e��[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, "�O�D�W��G", newboard.BM, IDLEN * 3 + 3, DOECHO);
+ getdata(11, 0, "�O�D�W��G", newboard.BM, sizeof(newboard.BM), DOECHO);
if(HAS_PERM(PERM_SYSOP) && !(newboard.brdattr & BRD_HIDE)) {
- getdata_str(14, 0, "�]�wŪ�g�v��(Y/N)�H", ans, 3, LCECHO, "N");
+ getdata_str(14, 0, "�]�wŪ�g�v��(Y/N)�H", ans, sizeof(ans), LCECHO, "N");
if(*ans == 'y') {
- getdata_str(15, 0, "���� [R]�\\Ū (P)�o���H", ans, 4, LCECHO, "R");
+ getdata_str(15, 0, "���� [R]�\\Ū (P)�o���H", 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���b���w�g�������U, "
- "��s(Y/N/Skip)�H\033[m[N] ", ans, 3, LCECHO);
+ "��s(Y/N/Skip)�H\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, "�}�l�f�ֶ�(Auto/Yes/No)�H[N] ", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, "�}�l�f�ֶ�(Auto/Yes/No)�H[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, "���w�ϥΪ�(S) �����ϥΪ�(A) ����(Q)�H[S]", buf, 3, LCECHO);
+ getdata(0, 0, "���w�ϥΪ�(S) �����ϥΪ�(A) ����(Q)�H[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,"[�j�M]����r:", search_str, 40, DOECHO))
+ if(getdata(b_lines - 1, 1,"[�j�M]����r:", 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, "[�j�M]����r:", search_str, 40, DOECHO);
+ getdata(b_lines - 1, 1, "[�j�M]����r:", 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, "�T�w�n����[%s]��(Y/N)�H[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, "�T�w�n�N[%s]���[�󦹶�(Y/N)�H[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,
"�O�_����ñ�W�ɳ���(Y/N)�H[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, "�п�J�� %d �ﶵ���s���ǡG", 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, "�z�T�w�n�R������ذϳs�u��(Y/N)�H[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, "�z�T�w�n�R���� symbolic link ��(Y/N)�H[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, "�z�T�w�n�R�����ɮ׶�(Y/N)�H[N] ", ans, 3,
- LCECHO);
+ getdata(b_lines - 1, 1, "�z�T�w�n�R�����ɮ׶�(Y/N)�H[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, "�z�T�w�n�R����ӥؿ���(Y/N)�H[N] ", ans, 3,
- LCECHO);
+ getdata(b_lines - 1, 1, "�z�T�w�n�R����ӥؿ���(Y/N)�H[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 �l�������� */
getdata(b_lines - 1, 1, "�z�T�w�n�R�����l�������ض�(Y/N)�H[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 ?
"�n��d�� Plugin ��峹��?[y/N]":
"�T�w�n�I�o���q��?[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�п�J�z�n�ǩI�����X\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�п�J�ǩI�T��\033[m�G", tmpbuf, 63, LCECHO)) {
hpressanykey("���ǩI");
return;
}
pager_msg_encode(Msg,tmpbuf);
getdata(9, 0, "\033[1;37m�p�G�A�n���W�e�� '1' "
- "�p�G�n�w�ɰe�Ы� '2': \033[m", ans, 2, LCECHO);
+ "�p�G�n�w�ɰe�Ы� '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 �бz��J�z�n�ǩI�����X : 0941- \033[m",
- PAGER_NO, 7, LCECHO) ||
+ PAGER_NO, sizeof(PAGER_NO), LCECHO) ||
!getdata(8, 0, "\033[1;37m�п�J�ǩI�T��\033[m�G", trn, 17, LCECHO)) {
hpressanykey("���ǩI");
return;
}
pager_msg_encode(TRAN_MSG,trn);
getdata(9,0, "\033[1;37m�p�G�A�n���W�e�� '1' "
- "�p�G�n�w�ɰe�Ы� '2': \033[m", ans, 2, LCECHO);
+ "�p�G�n�w�ɰe�Ы� '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�п�J�z�n�ǩI�����X\033[m�G0948-",
- svc_no, 7, LCECHO) ||
+ svc_no, sizeof(svc_no), LCECHO) ||
!getdata(8, 0, "\033[1;37m�п�J�ǩI�T��\033[m�G", trn, 61, LCECHO)) {
hpressanykey("���ǩI");
return;
}
pager_msg_encode(message, trn);
getdata(9, 0, "\033[1;37m�p�G�A�n���W�e�� '1' "
- "�p�G�n�w�ɰe�Ы� '2'\033[m: ", ans, 2, LCECHO);
+ "�p�G�n�w�ɰe�Ы� '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 �|�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w"
"�w�w�w�w�w�w�w�w�w�}\033[m\n");
- getdata(7, 8, "\033[1;37m�A�����? [1-4]\033[m", ch, 2, LCECHO);
+ getdata(7, 8, "\033[1;37m�A�����? [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() {
"�w�g�y���ܦh�H�����K\033[m\n");
prints("\033[1;37m�A�O�_�T�w�H�ᤣ�|�A�ǤF�H\033[m\n");
- if(!getdata(10,0,"�T�w�ܡH[y/n]:", ok, 2, LCECHO) ||
+ if(!getdata(10,0,"�T�w�ܡH[y/n]:", ok, sizeof(ok), LCECHO) ||
ok[0] == 'n' || ok[0] == 'N') {
mprints(22,0,"\033[1;31m���A�Q�q�F�A�ӧa!! "
"�ڬ۫H�A���|�������諸~~~\033[m");
@@ -100,7 +100,7 @@ int save_violatelaw() {
cuser.vl_count, cuser.vl_count*1000);
mprints(11,0,buf);
- if(!getdata(10, 0, "�n�I��[y/n]:", ok, 2, LCECHO) ||
+ if(!getdata(10, 0, "�n�I��[y/n]:", ok, sizeof(ok), LCECHO) ||
ok[0] == 'N' || ok[0] == 'n') {
mprints(22,0, "\033[1;31m �� �s���� �A�ӧa!!!\033[m");
@@ -1347,9 +1347,9 @@ static int tar_addqueue(int ent, fileheader_t *fhdr, char *direct) {
return FULLUPDATE;
}
- getdata(6, 0, "�n�ƥ��ݪ����e��(Y/N)?[Y]", ans, 2, LCECHO);
+ getdata(6, 0, "�n�ƥ��ݪ����e��(Y/N)?[Y]", ans, sizeof(ans), LCECHO);
bakboard = (ans[0] == 'n' || ans[0] =='N') ? 0 : 1;
- getdata(7, 0, "�n�ƥ���ذϤ��e��(Y/N)?[N]", ans, 2, LCECHO);
+ getdata(7, 0, "�n�ƥ���ذϤ��e��(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, "�O�_�n�Φۭqpost�`�N�ƶ�?", yn, 3, LCECHO);
+ getdata(b_lines - 2, 0, "�O�_�n�Φۭqpost�`�N�ƶ�?", 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,"�п�J�ݪO�s����ԭz:", genbuf,BTLEN -
- 16,DOECHO, bp->title + 7);
+ getdata_str(1,0,"�п�J�ݪO�s����ԭz:", 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, "�ثe�O�b���Ϊ��A, �n�����ι�(Y/N)?[N]", ans, 2, LCECHO);
+ getdata(1, 0, "�ثe�O�b���Ϊ��A, �n�����ι�(Y/N)?[N]",
+ ans, sizeof(ans), LCECHO);
if( ans[0] != 'y' && ans[0] != 'Y' )
return FULLUPDATE;
getdata(2, 0, "�A�T�{�@��, �u���n��O�O���}�� @____@(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, "�ثe�O�b�{�Ϊ��A, �n���ι�(Y/N)?[N]", ans, 2, LCECHO);
+ getdata(1, 0, "�ثe�O�b�{�Ϊ��A, �n���ι�(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,"�п�J�ݪO��������r:",keyword, 12, DOECHO);
+ getdata_buf(b_lines-1,0,"�п�J�ݪO��������r:",
+ 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, "�n�I���֩O:[�i������ Enter ����q]", destid, IDLEN + 1, DOECHO);
+ getdata(13, 0, "�n�I���֩O:[�i������ Enter ����q]",
+ destid, sizeof(destid), DOECHO);
while (!destid[0]){
a_menu("�I�q�q��", SONGBOOK,0 );
clear();
- getdata(13, 0, "�n�I���֩O:[�i�� Enter ���s��q]", destid, IDLEN + 1, DOECHO);
+ getdata(13, 0, "�n�I���֩O:[�i�� Enter ���s��q]",
+ destid, sizeof(destid), DOECHO);
}
}
else
strcpy(destid,defaultid);
/* Heat:�I�q�̰ΦW�\�� */
- getdata(14,0, "�n�ΦW��?[y/n]:", ano, 2, DOECHO);
+ getdata(14,0, "�n�ΦW��?[y/n]:", ano, sizeof(ano), DOECHO);
if(!destid[0]) {
unlockutmpmode();
return 0;
}
- getdata_str(14, 0, "�Q�n�n��L(�o)��..:", say, 51, DOECHO, "�ڷR�p..");
+ getdata_str(14, 0, "�Q�n�n��L(�o)��..:", say,
+ sizeof(say), DOECHO, "�ڷR�p..");
sprintf(save_title, "%s:%s", (ano[0]=='y')?"�ΦW��":cuser.userid, say);
- getdata_str(16, 0, "�H��֪��H�c(�i��E-mail)?", receiver, 45,
- LCECHO, destid);
-
-
+ getdata_str(16, 0, "�H��֪��H�c(�i��E-mail)?",
+ receiver, sizeof(receiver), LCECHO, destid);
if (!trans_buffer[0]){
outs("\n���ۭn��q�o..�i�J�q���n�n����@���q�a..^o^");
@@ -278,7 +279,7 @@ int p_cloak() {
char buf[4];
getdata(b_lines-1, 0,
currutmp->invisible ? "�T�w�n�{��?[y/N]" : "�T�w�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, "�T�w�n��G�m?[y/N]", ans, 3, LCECHO);
+ getdata(b_lines-2, 0, "�T�w�n��G�m?[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, "�п�J�s�G�m:",
- 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,"�z���W�� %d �ʮe�q�A�٭n�A�R�h��?",
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 ]�z�{�b�@�� %d P��, �٭n�[�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, "�M��(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,"�d���J");
while(strlen(mychicken->name)<3)
- getdata(8, 0, "���e���Ӧn�W�r�G", mychicken->name, 18, DOECHO);
+ getdata(8, 0, "���e���Ӧn�W�r�G", mychicken->name,
+ sizeof(mychicken->name), DOECHO);
now = time(NULL);
sprintf(buf,"\033[31m%s \033[m�i�F�@���s\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, "�n�R�h�֥��O:", buf, 4, DOECHO, "1");
+ getdata_str(b_lines - 1, 0, "�n�R�h�֥��O:",
+ buf, sizeof(buf), DOECHO, "1");
num = atoi(buf);
if(num < 1)
return;
@@ -414,7 +416,7 @@ static void ch_kill() {
sprintf(buf, "��i�o%s�n�Q�@ 100 ��, �O�_�n��i?(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, "�o��%d��%s�i�H�� %d ��, �O�_�n��?(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 ��F �� %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��h�ֿ��O\033[1;37m(�j��10 �p��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, "�T�wŪ�J��(Y/N)?[Y]", ans, 4, LCECHO);
+ getdata(b_lines - 1, 0, "�T�wŪ�J��(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, "�Ȧs�ɤw����� (A)���[ (W)�мg (Q)�����H[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, "�T�w�R����(Y/N)?[N]", ans, 4, LCECHO);
+ getdata(b_lines - 1, 0, "�T�w�R����(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)�~��s�� (W)�j��g�J�H[E] ", ans, 4, LCECHO);
+ getdata(12, 12, "(E)�~��s�� (W)�j��g�J�H[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, "�п�J�A�Q�Ϊ�ID�A�]�i������[Enter]�A"
- "�άO��[r]�ίu�W�G", real_name, 12, DOECHO);
+ "�άO��[r]�ίu�W�G", real_name, sizeof(real_name), DOECHO);
else
getdata(3, 0, "�п�J�A�Q�Ϊ�ID�A�]�i������[Enter]�ϥέ�ID�G",
- 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]�x�s (L)�����H�� (A)��� (T)����D (E)�~�� "
"(R/W/D)Ū�g�R�Ȧs�ɡH";
- 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("�¼��D�G%s", save_title);
strcpy(ans,save_title);
- if(getdata_buf(4, 0, "�s���D�G", ans, TTLEN, DOECHO))
+ if(getdata_buf(4, 0, "�s���D�G", 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, "���ܲĴX��:", buf, 10, DOECHO) &&
+ (getdata(b_lines - 1, 0, "���ܲĴX��:", 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,"[�j�M]����r:",str, 65, DOECHO))
+ if(getdata_buf(b_lines - 1, 0,"[�j�M]����r:",
+ str, sizeof(str), DOECHO))
if(*str) {
if(getdata(b_lines - 1, 0, "�Ϥ��j�p�g(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, "�Ȧs�ɤw����� (A)���[ (W)�мg "
- "(Q)�����H[W] ", ans, 4, LCECHO);
+ "(Q)�����H[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,
"�п�J �G��/�e��/�I��[���`�զr�©�][0wb]�G",
- 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,
"�϶��L�եk�����J�r��(�w�]���ťզr��)",
- 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, "�s����y:", uident, 60, DOECHO))
+ char wall[60];
+ if (!getdata(0, 0, "�s����y:", uident, sizeof(wall), DOECHO))
continue;
if (getdata(0, 0, "�T�w��X�s����y? [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, "�������w��m :", pbuf, 4, DOECHO);
+ oldgetdata(17, 0, "�������w��m :", 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, "�n�O�d����������(y/N)", ans, 4, LCECHO);
+ getdata(19 , 0, "�n�O�d����������(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, "��J�|��Ʀr(������): ", data, 5, LCECHO);
+ getdata(6, 0, "��J�|��Ʀr(������): ", 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("�z�U�` :%d Ptt$", money);
- getdata_str(4, 0, "�z�n�M�q�����ɶ�? <y/n>[y]:", &ifcomputer, 2,
- LCECHO, "y");
- if(ifcomputer == 'y') {
- ifcomputer = 1;
+ getdata_str(4, 0, "�z�n�M�q�����ɶ�? <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, "�п�J�z�n���q���q���Ʀr: ", yournum, 5, LCECHO);
+ getdata(5, 0, "�п�J�z�n���q���q���Ʀr: ",
+ yournum, sizeof(yournum), LCECHO);
} while(!legal(atoi(yournum)));
move(8, 25);
prints("�q���q");
@@ -260,9 +261,9 @@ int guess_main() {
}
move(8, 55);
prints("�A�q");
- 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�Ш̤W�C�d�ҿ�J�@����(����enter���)\n");
getdata(10, 0, ":", buf, 65, DOECHO);
if(buf[0]) {
- getdata(13, 0, "�T�w�s�W?(Y/n)", a, 2, LCECHO);
+ getdata(13, 0, "�T�w�s�W?(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�w��ϥα��Ѳ��;� v0.00 �� \n");
outs("�������H�Ҿ�����,��Ѩt�����A���a.\n������ : �ݱ����Ǫk.\n");
- if(!getdata(7, 0, "���H�H�G", receiver, 60, DOECHO)) return 0;
+ if(!getdata(7, 0, "���H�H�G", receiver, sizeof(receiver), DOECHO))
+ return 0;
if(receiver[0] && !(searchuser(receiver) &&
getdata(8, 0, "�D �D�G", save_title,
- TTLEN, DOECHO))) {
+ sizeof(save_title), DOECHO))) {
move(10, 0);
outs("���H�H�ΥD�D�����T, ���ѵL�k�ǻ�. ");
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, "�п�J�H�c�۰���H��email�a�}:",
- ip, 41, DOECHO);
+ ip, sizeof(ip), DOECHO);
if(ip[0] && ip[0] != ' ') {
- getdata(b_lines, 0, "�T�w�}�Ҧ۰���H�\\��?(Y/n)", yn, 3,
+ getdata(b_lines, 0, "�T�w�}�Ҧ۰���H�\\��?(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, "���H�H�G", receiver, 60, DOECHO);
+ getdata(20, 0, "���H�H�G", receiver, sizeof(receiver), DOECHO);
if(strchr(receiver, '@') && !invalidaddr(receiver) &&
- getdata(21, 0, "�D �D�G", save_title, TTLEN, DOECHO))
+ getdata(21, 0, "�D �D�G", 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, "�w���Q�H�X�A�O�_�ۦs���Z(Y/N)�H[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, "�D�D�G", save_title, TTLEN, DOECHO);
+ getdata(2, 0, "�D�D�G", 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, "�D�D�G", fpath, 64, DOECHO);
+ getdata(2, 0, "�D�D�G", fpath, sizeof(fpath), DOECHO);
sprintf(save_title, "[�q�i] %s", fpath);
}
@@ -588,7 +588,7 @@ int mail_all() {
stand_title("���Ҧ��ϥΪ̪��t�γq�i");
setutmpmode(SMAIL);
- getdata(2, 0, "�D�D�G", fpath, 64, DOECHO);
+ getdata(2, 0, "�D�D�G", fpath, sizeof(fpath), DOECHO);
sprintf(save_title, "[�t�γq�i]\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, "�ĥέ���D�m%.60s�n��?[Y] ", xtitle);
- getdata(2, 0, genbuf, genbuf2, 4, LCECHO);
+ getdata(2, 0, genbuf, genbuf2, sizeof(genbuf2), LCECHO);
if(*genbuf2 == 'n')
if(getdata(2, 0, "���D�G", 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, "�п�J�N���A�ΥH[guest]���[�A�H[new]���U�G",
- 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, "�Ϥ��j�p�g(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"); /* �Q 3 �B */
prints("(3) �p��\n"); /* �Q 4 �B */
do {
- getdata(4, 0, "�п�ܤ@�ӹ�H�M�z�若:(1~5)", thinkstep, 2, LCECHO);
+ getdata(4, 0, "�п�ܤ@�ӹ�H�M�z�若:(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���d�� 1:�X�o�ɶ� 2:��F�ɶ�\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�j�M%s [%s] ",(stype & RS_FORWARD) ? "����":"���e",
(stype & RS_TITLE) ? "���D" : "�@��", 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("�L�k�����o�ӥN���A�Шϥέ^��r���A�åB���n�]�t�Ů�\n");
@@ -246,13 +247,14 @@ void new_register() {
oflush();
exit(1);
}
- if((getdata(19, 0, "�г]�w�K�X�G", passbuf, PASSLEN, NOECHO) < 3) ||
+ if((getdata(19, 0, "�г]�w�K�X�G", passbuf,
+ sizeof(passbuf), NOECHO) < 3) ||
!strcmp(passbuf, newuser.userid)) {
outs("�K�X��²��A���D�J�I�A�ܤ֭n 4 �Ӧr�A�Э��s��J\n");
continue;
}
strncpy(newuser.passwd, passbuf, PASSLEN);
- getdata(20, 0, "���ˬd�K�X�G", passbuf, PASSLEN, NOECHO);
+ getdata(20, 0, "���ˬd�K�X�G", passbuf, sizeof(passbuf), NOECHO);
if(strncmp(passbuf, newuser.passwd, PASSLEN)) {
outs("�K�X��J���~, ���s��J�K�X.\n");
continue;
@@ -291,33 +293,37 @@ void check_register() {
stand_title("�иԲӶ�g�ӤH���");
while(strlen(cuser.username) < 2)
- getdata(2, 0, "�︹�ʺ١G", cuser.username, 24, DOECHO);
+ getdata(2, 0, "�︹�ʺ١G", 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, "�u��m�W�G", cuser.realname, 20, DOECHO);
+ getdata(4, 0, "�u��m�W�G", cuser.realname,
+ sizeof(cuser.realname), DOECHO);
while(strlen(cuser.address) < 8)
- getdata(6, 0, "�p���a�}�G", cuser.address, 50, DOECHO);
+ getdata(6, 0, "�p���a�}�G", cuser.address,
+ sizeof(cuser.address), DOECHO);
/*
if(!strchr(cuser.email, '@')) {
bell();
move(t_lines - 4, 0);
- prints("�� ���F�z���v�q�A�ж�g�u�ꪺ E-mail address�A "
+ prints("�� ���F�z���v�q�A�ж�g�u�ꪺ E-mail address�A"
"�H��T�{�դU�����A\n"
"�榡�� \033[44muser@domain_name\033[0m �� \033[44muser"
"@\\[ip_number\\]\033[0m�C\n\n"
"�� �p�G�z�u���S�� E-mail�A������ [return] �Y�i�C");
do {
- getdata(8, 0, "�q�l�H�c�G", cuser.email, 50, DOECHO);
+ getdata(8, 0, "�q�l�H�c�G",
+ 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, "�п�J�z�ѥH�ܭt�d�G",
- reason, 60, DOECHO, "�ݪ����D:"));
+ reason, sizeof(reason), DOECHO, "�ݪ����D:"));
fprintf(fp, "\n \033[1;37m����%s�ק��v���z�ѬO�G%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, "�M��(C) ���ܳƧѿ�(M) �O�d(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, "�M��(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, "�N�� [%s]�G", 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, "�G�m [%s]�G", 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,"�п�J�ʺ�����r:",keyword, 12,
- DOECHO);
+ getdata_buf(b_lines-1,0,"�п�J�ʺ�����r:",
+ 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, "�s���T��:", genbuf, 60, DOECHO))
break;
- if (getdata(0, 0, "�T�w�s��? [Y]", ans, 4, LCECHO) &&
+ if (getdata(0, 0, "�T�w�s��? [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, "�o�b���z�ѡG", currutmp->chatid, 11,
- DOECHO))
+ !getdata(b_lines - 1, 0, "�o�b���z�ѡG",
+ 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, "�A�Q�� %s %s�ڡH�п��(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�w����I�s�A��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] �����]�w�A�� [Return] �����G",
- 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)�õo�s�i�H (3)�õo�s��H\n");
prints("(4)���Z���W�ϥΪ� (8)��L�H�@��B�m�欰\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, "�п�J�z�ѥH�ܭt�d�G", reason, 50, DOECHO));
+ while(!getdata(6, 0, "�п�J�z�ѥH�ܭt�d�G", 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)�]�K�X(3)�]�v��(4)��b��(5)��ID"
"(6)��/�_���d��(7)�f�P [0]���� " :
"�п�� (1)�ק��� (2)�]�w�K�X ==> [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("�гv���ק�C");
- getdata_buf(i++, 0," �� �� �G",x.username, 24, DOECHO);
+ getdata_buf(i++, 0," �� �� �G",x.username,
+ sizeof(x.username), DOECHO);
if(real) {
- getdata_buf(i++, 0, "�u��m�W�G", x.realname, 20, DOECHO);
- getdata_buf(i++, 0, "�����Ҹ��G", x.ident, 11, DOECHO);
- getdata_buf(i++, 0, "�~���a�}�G", x.address, 50, DOECHO);
+ getdata_buf(i++, 0, "�u��m�W�G",
+ x.realname, sizeof(x.realname), DOECHO);
+ getdata_buf(i++, 0, "�����Ҹ��G",
+ x.ident, sizeof(x.ident), DOECHO);
+ getdata_buf(i++, 0, "�~���a�}�G",
+ x.address, sizeof(x.address), DOECHO);
}
sprintf(buf, "%010d", x.mobile);
getdata_buf(i++, 0, "������X�G", 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, "�{�Ҹ�ơG", x.justify, 44, DOECHO);
- getdata_buf(i++, 0, "�̪���{�����G", x.lasthost, 16, DOECHO);
+ getdata_buf(i++, 0, "�{�Ҹ�ơG", x.justify,
+ sizeof(x.justify), DOECHO);
+ getdata_buf(i++, 0, "�̪���{�����G",
+ x.lasthost, sizeof(x.lasthost), DOECHO);
sprintf(genbuf, "%d", x.numlogins);
- if(getdata_str(i++, 0,"�W�u���ơG", buf, 10, DOECHO,genbuf))
+ if(getdata_str(i++, 0,"�W�u���ơG", 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, "�п�J��U�ҩ����ϥΪ̡G", witness[i], 32, DOECHO)){
+ if(!getdata(19+i, 0, "�п�J��U�ҩ����ϥΪ̡G",
+ witness[i], sizeof(witness[i]), DOECHO)){
outs("\n����J�h�L�k���\n");
fail++;
break;
@@ -534,7 +540,9 @@ void uinfo_query(userec_t *u, int real, int unum) {
clrtobot ();
clear();
- while(!getdata(5, 0, "�п�J�z�ѥH�ܭt�d�G", reason, 60, DOECHO));
+ while( !getdata(5, 0, "�п�J�z�ѥH�ܭt�d�G",
+ reason, sizeof(reason), DOECHO) )
+ ;
fprintf(fp, "\n \033[1;37m����%s�ק���z�ѬO�G%s\033[m",
cuser.userid, reason);
@@ -637,7 +645,8 @@ int u_editsig() {
j = showsignature(genbuf);
- getdata(0, 0, "ñ�W�� (E)�s�� (D)�R�� (Q)�����H[Q] ", ans, 4, LCECHO);
+ getdata(0, 0, "ñ�W�� (E)�s�� (D)�R�� (Q)�����H[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, "�п��ñ�W��(1-9)�H[1] ", ans, 4, DOECHO))
+ if(!getdata(1, 0, "�п��ñ�W��(1-9)�H[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) �z�n�A�п�J�z���{�ҽX�ο�J x���� E-Mail ",
cuser.userid, cuser.username);
inregcode[0] = 0;
- getdata(10, 0, "�z���{�ҽX: ", inregcode, 45, DOECHO);
+ getdata(10, 0, "�z���{�ҽX: ", 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, "�z�T�w�n��g���U���(Y/N)�H[N] ", ans, 3, LCECHO);
+ getdata(b_lines - 1, 0, "�z�T�w�n��g���U���(Y/N)�H[N] ",
+ ans, sizeof(ans), LCECHO);
if(ans[0] != 'y')
return FULLUPDATE;
@@ -1017,7 +1027,7 @@ int u_register(void)
}
getfield(17, "1.���� 2.�j�� ", "�ʧO", sex_is, 2);
getdata(18, 0, "�H�W��ƬO�_���T(Y/N)�H(Q)�������U [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'�}�l����F(�άO���N�����})): ", ch, 2, LCECHO);
+ getdata(8, 0, "��'c'�}�l����F(�άO���N�����})): ",
+ 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, "�п�J�벼�W��", inbuf, 30, LCECHO);
+ getdata(4, 0, "�п�J�벼�W��", inbuf, sizeof(inbuf), LCECHO);
if(inbuf[0]=='\0')
strcpy(inbuf,"�����W��");
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("�A�٥i�H�� %2d ��", tickets - i);
- getdata(t_lines - 4, 0, "��J�z�����: ", vote, 3, DOECHO);
+ getdata(t_lines - 4, 0, "��J�z�����: ", vote, sizeof(vote), DOECHO);
*vote = toupper(*vote);
if(vote[0] == '0' || (!vote[0] && !i)) {
outs("�O���A�ӧ��!!");
@@ -922,7 +923,8 @@ static int user_vote_one(char *bname, int ind) {
outs("�аݱz��o���벼�������_�Q���N���H"
"�̦h�T��A��[Enter]����");
for(i = 0; (i < 3) &&
- getdata(7 + i, 0, "�G", mycomments[i], 74,
+ getdata(7 + i, 0, "�G",
+ mycomments[i], sizeof(mycomments[i]),
DOECHO); i++);
getdata(b_lines-2,0, "(S)�x�s (E)���s�ӹL "
"(Q)�����H[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, "�аݱz�P�o��ij�D�����Y�γs�p�z�Ѭ���G", reason, 40, DOECHO)){
+ if (!getdata(20, 0, "�аݱz�P�o��ij�D�����Y�γs�p�z�Ѭ���G",
+ 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�뤭��... ��... �Яd�� (�ܦh�T��)�A��[Enter]����");
- for(i = 0; (i < 3) && getdata(16 + i, 0, "�G", myitem.buf[i], 78,
- DOECHO) && *myitem.buf[i]; i++);
+ for(i = 0; (i < 3) && getdata(16 + i, 0, "�G", myitem.buf[i],
+ sizeof(myitem.buf[i]), DOECHO)
+ && *myitem.buf[i]; i++);
getdata(b_lines - 1, 0, "(S)�x�s (E)���s�ӹL (Q)�����H[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, "�n�N���G�H�^�H�c��(Y/N)�H[N]", ans, 3, DOECHO,0);
+ getdata(0, 0, "�n�N���G�H�^�H�c��(Y/N)�H[N]",
+ ans, sizeof(ans), DOECHO, 0);
if(*ans == 'y') {
fileheader_t mhdr;
char title[128], buf1[80];