summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-13 03:35:18 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-13 03:35:18 +0800
commit4e1ad2af155038106cd14a7f5deeee5771b3a531 (patch)
treee813b8f55e370ac55aba06c310c648f7e3531a4e /mbbsd
parent2ec15646e35a5a49bea7eff28963c906afc5fc16 (diff)
downloadpttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar
pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.gz
pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.bz2
pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.lz
pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.xz
pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.zst
pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.zip
* fix bug: incorrect user's tmp buf filename.
* don't test upper case if getdata with LCECHO flag * add some comment * some small code revise git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4585 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/angel.c6
-rw-r--r--mbbsd/bbs.c9
-rw-r--r--mbbsd/card.c6
-rw-r--r--mbbsd/chicken.c2
-rw-r--r--mbbsd/edit.c33
-rw-r--r--mbbsd/mail.c2
-rw-r--r--mbbsd/menu.c2
-rw-r--r--mbbsd/passwd.c2
-rw-r--r--mbbsd/read.c13
-rw-r--r--mbbsd/register.c4
-rw-r--r--mbbsd/talk.c7
-rw-r--r--mbbsd/var.c7
-rw-r--r--mbbsd/vote.c4
13 files changed, 49 insertions, 48 deletions
diff --git a/mbbsd/angel.c b/mbbsd/angel.c
index e2eef9ec..240e51a2 100644
--- a/mbbsd/angel.c
+++ b/mbbsd/angel.c
@@ -134,7 +134,7 @@ t_changeangel(){
getdata(b_lines - 1, 0,
"�󴫤p�Ѩϫ�N�L�k���^�F��I �O�_�n�󴫤p�ѨϡH [y/N]",
buf, 3, LCECHO);
- if (buf[0] == 'y' || buf[0] == 'Y') {
+ if (buf[0] == 'y') {
char buf[100];
snprintf(buf, sizeof(buf), "%s �p�D�H %s ���� %s �p�Ѩ�\n",
Cdatelite(&now), cuser.userid, cuser.myangel);
@@ -195,8 +195,8 @@ t_angelmsg(){
++i);
getdata(b_lines - 2, 0, "(S)�x�s (E)���s�ӹL (Q)�����H[S]",
buf, 4, LCECHO);
- } while (buf[0] == 'E' || buf[0] == 'e');
- if (buf[0] == 'Q' || buf[0] == 'q')
+ } while (buf[0] == 'e');
+ if (buf[0] == 'q')
return 0;
setuserfile(buf, "angelmsg");
if (msg[0][0] == 0)
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 338ac7c2..8099e60d 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -307,11 +307,12 @@ set_board(void)
}
}
+// post �峹��������O
int IsFreeBoardName(const char *brdname)
{
- if (strcmp(currboard, BN_TEST) == 0)
+ if (strcmp(brdname, BN_TEST) == 0)
return 1;
- if (strcmp(currboard, BN_ALLPOST) == 0)
+ if (strcmp(brdname, BN_ALLPOST) == 0)
return 1;
return 0;
}
@@ -3602,9 +3603,9 @@ tar_addqueue(void)
}
#endif
getdata(6, 0, "�n�ƥ��ݪO���e��(Y/N)?[Y]", ans, sizeof(ans), LCECHO);
- bakboard = (ans[0] == 'n' || ans[0] == 'N') ? 0 : 1;
+ bakboard = (ans[0] == 'n') ? 0 : 1;
getdata(7, 0, "�n�ƥ���ذϤ��e��(Y/N)?[N]", ans, sizeof(ans), LCECHO);
- bakman = (ans[0] == 'y' || ans[0] == 'Y') ? 1 : 0;
+ bakman = (ans[0] == 'y') ? 1 : 0;
if (!bakboard && !bakman) {
move(8, 0);
outs("�i�O�ڭ̥u��ƥ��ݪO�κ�ذϪ��C ^^\"\"\"");
diff --git a/mbbsd/card.c b/mbbsd/card.c
index c3b33d08..5735c4c6 100644
--- a/mbbsd/card.c
+++ b/mbbsd/card.c
@@ -477,7 +477,7 @@ card_double_ask(void)
if (card_get_money() < JACK)
return 0;
getdata(20, 0, buf, buf2, sizeof(buf2), LCECHO);
- if (buf2[0] == 'y' || buf2[0] == 'Y')
+ if (buf2[0] == 'y')
return 1;
return 0;
}
@@ -497,9 +497,9 @@ card_ask(void)
if (buf2[0] == ' ')
buf2[0] = buf2[1];
- if (buf2[0] == 'y' || buf2[0] == 'Y')
+ if (buf2[0] == 'y')
return 1;
- if (buf2[0] == 'q' || buf2[0] == 'Q')
+ if (buf2[0] == 'q')
return -1;
return 0;
}
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c
index 12921166..32288158 100644
--- a/mbbsd/chicken.c
+++ b/mbbsd/chicken.c
@@ -890,7 +890,7 @@ recover_chicken(chicken_t * thechicken)
outmsg(buf);
bell();
getdata(21, 0, " ��� (N:�|�H��/y:��������): ", buf, 3, LCECHO);
- if (buf[0] == 'y' || buf[0] == 'Y') {
+ if (buf[0] == 'y') {
reload_money();
if (cuser.money < price) {
outmsg(ANSI_COLOR(33;44) "���F�ɦu��" ANSI_COLOR(37;45) " ���� ���S�a�� "
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 75600d81..50facfb1 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1084,17 +1084,18 @@ load_file(FILE * fp, off_t offSig)
}
/* �Ȧs�� */
-char *
+const char *
ask_tmpbuf(int y)
{
- static char fp_buf[10] = "buf.0";
- static char msg[] = "�п�ܼȦs�� (0-9)[0]: ";
+ static char fp_buf[] = "buf.0";
+ char msg[] = "�п�ܼȦs�� (0-9)[0]: ";
+ char choice[2];
msg[19] = fp_buf[4];
do {
- if (!getdata(y, 0, msg, fp_buf + 4, 4, DOECHO))
- fp_buf[4] = msg[19];
- } while (fp_buf[4] < '0' || fp_buf[4] > '9');
+ getdata(y, 0, msg, choice, sizeof(choice), DOECHO);
+ } while (choice[0] < '0' || choice[0] > '9');
+ fp_buf[4] = choice[0];
return fp_buf;
}
@@ -1104,7 +1105,7 @@ read_tmpbuf(int n)
FILE *fp;
char fp_tmpbuf[80];
char tmpfname[] = "buf.0";
- char *tmpf;
+ const char *tmpf;
char ans[4] = "y";
if (curr_buf->totaln >= EDIT_LINE_LIMIT)
@@ -2009,26 +2010,28 @@ block_prompt(void)
{
char fp_tmpbuf[80];
char tmpfname[] = "buf.0";
- char mode[2];
+ char mode[2] = "w";
+ char choice[2];
move(b_lines - 1, 0);
clrtoeol();
- if (!getdata(b_lines - 1, 0, "��϶����ܼȦs�� (0:Cut, 5:Copy, 6-9, q: Cancel)[0] ", tmpfname + 4, 4, LCECHO))
- tmpfname[4] = '0';
+ if (!getdata(b_lines - 1, 0, "��϶����ܼȦs�� (0:Cut, 5:Copy, 6-9, q: Cancel)[0] ", choice, sizeof(choice), LCECHO))
+ choice[0] = '0';
- if (tmpfname[4] < '0' || tmpfname[4] > '9')
+ if (choice[0] < '0' || choice[0] > '9')
goto cancel_block;
- if (tmpfname[4] == '0') {
+ if (choice[0] == '0') {
block_cut();
return;
}
- else if (tmpfname[4] == '5') {
+ else if (choice[0] == '5') {
block_copy();
return;
}
+ tmpfname[4] = choice[0];
setuserfile(fp_tmpbuf, tmpfname);
if (dashf(fp_tmpbuf)) {
more(fp_tmpbuf, NA);
@@ -3131,7 +3134,7 @@ insert_ansi_code(void)
int ch = curr_buf->insert_mode;
curr_buf->insert_mode = curr_buf->redraw_everything = YEA;
if (!curr_buf->ansimode)
- insert_string(reset_color);
+ insert_string(ANSI_RESET);
else {
char ans[4];
move(b_lines - 2, 55);
@@ -3169,7 +3172,7 @@ insert_ansi_code(void)
strcat(color, "m");
insert_string(color);
} else
- insert_string(reset_color);
+ insert_string(ANSI_RESET);
}
curr_buf->insert_mode = ch;
}
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 9cf2b13d..f899b673 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -1726,7 +1726,7 @@ mail_waterball(int ent GCC_UNUSED, fileheader_t * fhdr, const char *direct GCC_U
"�Ҧ� 0: ��²�Ҧ�, �N���t�C�ⱱ��X, ��K�H�¤�r�s�边��z����\n"
"�Ҧ� 1: ���R�Ҧ�, �]�t�C�ⱱ��X��, ��K�b bbs�W�����s�覬��\n");
getdata(b_lines - 1, 0, "�ϥμҦ�(0/1/Q)? [1]", fname, 3, LCECHO);
- if (fname[0] == 'Q' || fname[0] == 'q') {
+ if (fname[0] == 'q') {
outmsg("�����B�z");
return FULLUPDATE;
}
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index a6421bcb..778f10d0 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -276,7 +276,7 @@ movie(int cmdmode)
#else
out_lines(SHM->notes[i], 11, 0); /* �u�L11��N�n */
#endif
- outs(reset_color);
+ outs(ANSI_RESET);
}
typedef struct {
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index 0c44d894..1b55952a 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -5,6 +5,8 @@
#error sorry, mbbsd/passwd.c does not support utility mode anymore. please use libcmbbs instead.
#endif
+static uint32_t latest_numposts;
+
void
passwd_force_update(int flag)
{
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 12c334e3..cdb94944 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -10,6 +10,12 @@ static int last_line; // PTT: last_line ��Хi�����̫�@��
/* ----------------------------------------------------- */
/* Tag List ���� */
/* ----------------------------------------------------- */
+typedef struct
+{
+ time4_t chrono;
+ int recno;
+} TagItem;
+
static TagItem *TagList = NULL; /* ascending list */
/**
@@ -118,8 +124,6 @@ AskTag(const char *msg)
#include <sys/mman.h>
-#define BATCH_SIZE 65536
-
static char *
f_map(const char *fpath, int *fsize)
{
@@ -976,9 +980,6 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
int id;
userec_t muser;
- strlcpy(currauthor,
- headers[locmem->crs_ln - locmem->top_ln].owner,
- sizeof(currauthor));
vs_hdr("�ϥΪ̳]�w");
move(1, 0);
if ((id = getuser(headers[locmem->crs_ln - locmem->top_ln].owner, &muser))) {
@@ -1136,7 +1137,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
// XXX never return -1!
static int
-get_records_and_bottom(char *direct, fileheader_t* headers,
+get_records_and_bottom(const char *direct, fileheader_t* headers,
int recbase, int headers_size, int last_line, int bottom_line)
{
// n: �m�����~���i��ܼƥ�
diff --git a/mbbsd/register.c b/mbbsd/register.c
index eaa85fb2..df6fa4eb 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -1185,7 +1185,7 @@ toregister(char *email)
char yn[3];
getdata(16, 0, "�ЦA���T�{�z��J��������X���T��? [y/N]",
yn, sizeof(yn), LCECHO);
- if (yn[0] == 'Y' || yn[0] == 'y')
+ if (yn[0] == 'y')
break;
} else {
move(15, 0); clrtobot();
@@ -1221,7 +1221,7 @@ toregister(char *email)
getdata(16, 0, "�ЦA���T�{�z��J�� E-Mail ��m���T��? [y/N]",
yn, sizeof(yn), LCECHO);
clrtobot();
- if (yn[0] == 'Y' || yn[0] == 'y')
+ if (yn[0] == 'y')
break;
#ifdef USE_EMAILDB
}
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 130ed593..28873ce5 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1628,7 +1628,6 @@ my_talk(userinfo_t * uin, int fri_stat, char defact)
genbuf[0] = defact;
ch = uin->mode;
- strlcpy(currauthor, uin->userid, sizeof(currauthor));
if (ch == EDITING || ch == TALK || ch == CHATING || ch == PAGE ||
ch == MAILALL || ch == MONITOR || ch == M_FIVE || ch == CHC ||
@@ -2751,7 +2750,7 @@ userlist(void)
msgque_t msg;
getdata(1, 0, "�A���T�w�����s��? [N]",
ans, sizeof(ans), LCECHO);
- if( ans[0] != 'y' && ans[0] != 'Y' ){
+ if( ans[0] != 'y'){
vmsg("abort");
break;
}
@@ -2823,7 +2822,6 @@ userlist(void)
if (HasUserPerm(PERM_ACCOUNTS|PERM_SYSOP)) {
int id;
userec_t muser;
- strlcpy(currauthor, uentp->userid, sizeof(currauthor));
vs_hdr("�ϥΪ̳]�w");
move(1, 0);
if ((id = getuser(uentp->userid, &muser)) > 0) {
@@ -2934,7 +2932,6 @@ userlist(void)
break;
case 'q':
- strlcpy(currauthor, uentp->userid, sizeof(currauthor));
my_query(uentp->userid);
setutmpmode(LUSERS);
redrawall = redraw = 1;
@@ -3203,7 +3200,7 @@ t_talk(void)
return 0;
}
-int
+static int
reply_connection_request(const userinfo_t *uip)
{
char buf[4], genbuf[200];
diff --git a/mbbsd/var.c b/mbbsd/var.c
index 7a19f051..a9f52c73 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -92,10 +92,8 @@ int currbid;
char quote_file[80] = "\0";
char quote_user[80] = "\0";
char currtitle[TTLEN + 1] = "\0";
-char currauthor[IDLEN + 2] = "\0";
const char *currboard = "\0";
char currBM[IDLEN * 3 + 10];
-const char reset_color[4] = ANSI_RESET;
char margs[64] = "\0"; /* main argv list */
pid_t currpid; /* current process ID */
time4_t login_start_time;
@@ -104,7 +102,6 @@ userec_t cuser; /* current user structure */
crosspost_t postrecord; /* anti cross post */
unsigned int currbrdattr;
unsigned int currstat;
-uint32_t latest_numposts;
/* global string variables */
/* filename */
@@ -313,9 +310,9 @@ char * const ModeTypeTable[] = {
};
/* term.c */
-int b_lines = 23; // bottom line of screen
+int b_lines = 23; // bottom line of screen (= t_lines - 1)
int t_lines = 24; // term lines
-int p_lines = 20;
+int p_lines = 20; // ���� header(3), footer(1), �e���W�i�H��ܸ�ƪ����
int t_columns = 80;
/* refer to ansi.h for *len */
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index d08107d3..74180714 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -958,8 +958,8 @@ user_vote_one(vote_buffer_t *vbuf, const char *bname, int ind)
DOECHO); i++);
getdata(b_lines - 2, 0, "(S)�x�s (E)���s�ӹL "
"(Q)�����H[S]", buf, 3, LCECHO);
- } while (buf[0] == 'E' || buf[0] == 'e');
- if (buf[0] == 'Q' || buf[0] == 'q')
+ } while (buf[0] == 'e');
+ if (buf[0] == 'q')
break;
setbfile(b_comments, bname, vbuf->comments);
if (mycomments[0][0])