summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-15 20:41:00 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-15 20:41:00 +0800
commitb73be94cdccb1752e25b731db46477f28ce30a90 (patch)
tree7b7c19ce210b190ed7d4c4bab7bbb84fd9146aaa
parent9cffa0dd2fd15f104bbd3abbfdb1fe6497f51749 (diff)
downloadpttbbs-b73be94cdccb1752e25b731db46477f28ce30a90.tar
pttbbs-b73be94cdccb1752e25b731db46477f28ce30a90.tar.gz
pttbbs-b73be94cdccb1752e25b731db46477f28ce30a90.tar.bz2
pttbbs-b73be94cdccb1752e25b731db46477f28ce30a90.tar.lz
pttbbs-b73be94cdccb1752e25b731db46477f28ce30a90.tar.xz
pttbbs-b73be94cdccb1752e25b731db46477f28ce30a90.tar.zst
pttbbs-b73be94cdccb1752e25b731db46477f28ce30a90.zip
re-indent
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2067 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c423
1 files changed, 213 insertions, 210 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index ad38e206..a4df61dc 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -30,7 +30,7 @@ mail_by_link(char *owner, char *title, char *path)
void
-anticrosspost()
+anticrosspost(void)
{
log_file("etc/illegal_money", LOG_CREAT | LOG_VF,
"\033[1;33;46m%s \033[37;45mcross post �峹 \033[37m %s\033[m\n",
@@ -47,7 +47,7 @@ anticrosspost()
/* Heat CharlieL */
int
-save_violatelaw()
+save_violatelaw(void)
{
char buf[128], ok[3];
@@ -105,7 +105,7 @@ save_violatelaw()
static time_t *board_note_time;
void
-set_board()
+set_board(void)
{
boardheader_t *bp;
@@ -129,7 +129,8 @@ set_board()
}
/* check post perm on demand, no double checks in current board */
-int CheckPostPerm(void)
+int
+CheckPostPerm(void)
{
if (!(currmode & MODE_POSTCHECKED)) {
currmode |= MODE_POSTCHECKED;
@@ -144,7 +145,7 @@ int CheckPostPerm(void)
}
static void
-readtitle()
+readtitle(void)
{
boardheader_t *bp;
char *brd_title;
@@ -158,7 +159,8 @@ readtitle()
showtitle(currBM, brd_title);
prints("[��]���} [��]�\\Ū [^P]�o���峹 [b]�Ƨѿ� [d]�R�� [z]��ذ� "
"[TAB]��K [h]elp\n\033[7m �s�� �� �� �@ �� �� �� �� �D"
- " �H��:%-5d \033[m", SHM->bcache[currbid - 1].nuser);
+ " �H��:%-5d \033[m",
+ SHM->bcache[currbid - 1].nuser);
}
static void
@@ -193,8 +195,8 @@ readdoent(int num, fileheader_t * ent)
else
color = '3', mark = "R:";
- if (title[45])
- strlcpy(title + 42, " �K", sizeof(title) - 42); /* ��h�l�� string �屼 */
+ if (title[45]) /* ��h�l�� string �屼 */
+ strlcpy(title + 42, " �K", sizeof(title) - 42);
if (!strncmp(title, "[���i]", 6))
special = 1;
@@ -316,7 +318,7 @@ do_select(int ent, fileheader_t * fhdr, char *direct)
/* ��} innbbsd ��X�H��B�s�u��H���B�z�{�� */
/* ----------------------------------------------------- */
void
-outgo_post(fileheader_t * fh, char *board)
+outgo_post(fileheader_t *fh, char *board)
{
FILE *foo;
@@ -328,7 +330,7 @@ outgo_post(fileheader_t * fh, char *board)
}
static void
-cancelpost(fileheader_t * fh, int by_BM, char *newpath)
+cancelpost(fileheader_t *fh, int by_BM, char *newpath)
{
FILE *fin, *fout;
char *ptr, *brd;
@@ -442,66 +444,72 @@ do_crosspost(char *brd, fileheader_t *postfile, const char *fpath)
static void
setupbidinfo(bid_t *bidinfo)
{
- char buf[256];
- bidinfo->enddate = gettime(20, now+86400,"�����Юש�");
- do
- getdata_str(21,0,"����:",buf, 8, LCECHO, "1");
- while((bidinfo->high=atoi(buf))<=0);
- do
- getdata_str(21,20, "�C�ЦܤּW�[�h��:",buf, 5, LCECHO, "1");
- while((bidinfo->increment=atoi(buf))<=0);
- getdata(21,44, "�����ʶR��(�i���]):",buf, 10, LCECHO);
- bidinfo->buyitnow=atoi(buf);
+ char buf[256];
+ bidinfo->enddate = gettime(20, now+86400,"�����Юש�");
+ do{
+ getdata_str(21, 0, "����:", buf, 8, LCECHO, "1");
+ } while( (bidinfo->high = atoi(buf)) <= 0 );
+ do{
+ getdata_str(21, 20, "�C�ЦܤּW�[�h��:", buf, 5, LCECHO, "1");
+ } while( (bidinfo->increment = atoi(buf)) <= 0 );
+ getdata(21,44, "�����ʶR��(�i���]):",buf, 10, LCECHO);
+ bidinfo->buyitnow = atoi(buf);
- getdata_str(22,0,
- "�I�ڤ覡: 1.Ptt�� 2.�l���λȦ���b 3.�䲼�ιq�� 4.�l���f��I�� [1]:",
- buf, 3, LCECHO,"1");
- bidinfo->payby=(buf[0]-'1');
- if(bidinfo->payby<0 ||bidinfo->payby>3)bidinfo->payby=0;
- getdata_str(23,0, "�B�O(0:�K�B�O�Τ夤����)[0]:", buf, 6, LCECHO, "0");
- bidinfo->shipping = atoi(buf);
- if(bidinfo->shipping<0) bidinfo->shipping=0;
+ getdata_str(22,0,
+ "�I�ڤ覡: 1.Ptt�� 2.�l���λȦ���b 3.�䲼�ιq�� 4.�l���f��I�� [1]:",
+ buf, 3, LCECHO,"1");
+ bidinfo->payby = (buf[0] - '1');
+ if( bidinfo->payby < 0 || bidinfo->payby > 3)
+ bidinfo->payby = 0;
+ getdata_str(23, 0, "�B�O(0:�K�B�O�Τ夤����)[0]:", buf, 6, LCECHO, "0");
+ bidinfo->shipping = atoi(buf);
+ if( bidinfo->shipping < 0 )
+ bidinfo->shipping = 0;
}
static void
print_bidinfo(FILE *io, bid_t bidinfo)
{
- char *payby[4]={ "Ptt��","�l���λȦ���b","�䲼�ιq��","�l���f��I��"};
- if(io)
- {
- if(!bidinfo.userid[0])
- fprintf(io,"�_�л�: %-20d\n",bidinfo.high);
- else
- fprintf(io, "�ثe�̰���:%-20d�X����:%-16s\n",bidinfo.high, bidinfo.userid);
- fprintf(io, "�I�ڤ覡: %-20s������:%-16s\n",payby[bidinfo.payby%4],Cdate(& bidinfo.enddate));
- if(bidinfo.buyitnow)
- fprintf(io, "�����ʶR��:%-20d",bidinfo.buyitnow);
- if(bidinfo.shipping)
- fprintf(io, "�B�O:%d", bidinfo.shipping);
- fprintf(io, "\n");
- }
- else
- {
- if(!bidinfo.userid[0])
- prints("�_�л�: %-20d\n",bidinfo.high);
- else
- prints("�ثe�̰���:%-20d�X����:%-16s\n",bidinfo.high, bidinfo.userid);
- prints("�I�ڤ覡: %-20s������:%-16s\n",payby[bidinfo.payby%4],Cdate(& bidinfo.enddate));
- if(bidinfo.buyitnow)
- prints("�����ʶR��:%-20d",bidinfo.buyitnow);
- if(bidinfo.shipping)
- prints("�B�O:%d", bidinfo.shipping);
- outc('\n');
+ char *payby[4]={"Ptt��", "�l���λȦ���b", "�䲼�ιq��", "�l���f��I��"};
+ if(io){
+ if( !bidinfo.userid[0] )
+ fprintf(io, "�_�л�: %-20d\n", bidinfo.high);
+ else
+ fprintf(io, "�ثe�̰���:%-20d�X����:%-16s\n",
+ bidinfo.high, bidinfo.userid);
+ fprintf(io, "�I�ڤ覡: %-20s������:%-16s\n",
+ payby[bidinfo.payby % 4], Cdate(& bidinfo.enddate));
+ if(bidinfo.buyitnow)
+ fprintf(io, "�����ʶR��:%-20d", bidinfo.buyitnow);
+ if(bidinfo.shipping)
+ fprintf(io, "�B�O:%d", bidinfo.shipping);
+ fprintf(io, "\n");
+ }
+ else{
+ if(!bidinfo.userid[0])
+ prints("�_�л�: %-20d\n", bidinfo.high);
+ else
+ prints("�ثe�̰���:%-20d�X����:%-16s\n",
+ bidinfo.high, bidinfo.userid);
+ prints("�I�ڤ覡: %-20s������:%-16s\n",
+ payby[bidinfo.payby % 4], Cdate(& bidinfo.enddate));
+ if(bidinfo.buyitnow)
+ prints("�����ʶR��:%-20d", bidinfo.buyitnow);
+ if(bidinfo.shipping)
+ prints("�B�O:%d", bidinfo.shipping);
+ outc('\n');
}
-
}
+
static int
do_general(int isbid)
{
- bid_t bidinfo;
+ bid_t bidinfo;
fileheader_t postfile;
char fpath[80], buf[80];
int aborted, defanony, ifuseanony, i;
- char genbuf[200], *owner, ctype[8][5] = {"���D", "��ij", "�Q��", "�߱o", "����", "�Яq", "���i", "����"};
+ char genbuf[200], *owner;
+ char ctype[8][5] = {"���D", "��ij", "�Q��", "�߱o",
+ "����", "�Яq", "���i", "����"};
boardheader_t *bp;
int islocal, posttype=-1;
@@ -509,10 +517,10 @@ do_general(int isbid)
bp = getbcache(currbid);
clear();
- if (!CheckPostPerm()
+ if( !CheckPostPerm()
#ifdef FOREIGN_REG
- // ���O�~�y�ϥΪ̦b PttForeign �O
- && !((cuser.uflag2 & FOREIGN) && strcmp(bp->brdname, "PttForeign") == 0)
+ // ���O�~�y�ϥΪ̦b PttForeign �O
+ && !((cuser.uflag2 & FOREIGN) && strcmp(bp->brdname, "PttForeign") == 0)
#endif
) {
vmsg("�藍�_�A�z�ثe�L�k�b���o���峹�I");
@@ -722,7 +730,7 @@ do_general(int isbid)
}
int
-do_post()
+do_post(void)
{
boardheader_t *bp;
bp = getbcache(currbid);
@@ -734,13 +742,13 @@ do_post()
}
int
-do_post_vote()
+do_post_vote(void)
{
return do_voteboard(1);
}
int
-do_post_openbid()
+do_post_openbid(void)
{
boardheader_t *bp;
bp = getbcache(currbid);
@@ -815,27 +823,26 @@ b_posttype(int ent, fileheader_t * fhdr, char *direct)
move(2,0);
clrtobot();
- posttype_f = bp->posttype_f;
- for(i=0; i<8; i++)
- {
+ posttype_f = bp->posttype_f;
+ for( i = 0 ; i < 8 ; ++i ){
move(2,0);
outs("�峹����: ");
- strncpy(genbuf, bp->posttype+i*4, 4);
- genbuf[4]=0;
- sprintf(title,"%d.",i+1);
- if(!getdata_buf(2,11, title, genbuf, 5, DOECHO)) break;
- sprintf(posttype+i*4,"%-4.4s", genbuf);
- if( posttype_f & (1<<i) )
- {
- if(getdata(2, 20, "�]�w�d���榡�H(Y/n)", genbuf, 3, LCECHO) &&
- genbuf[0]=='n')
- {
- posttype_f &= ~(1<<i);
- continue;
- }
- }
- else if (!getdata(2, 20, "�]�w�d���榡�H(y/N)", genbuf, 3, LCECHO) ||
- genbuf[0]!='y') continue;
+ strncpy(genbuf, bp->posttype + i * 4, 4);
+ genbuf[4] = 0;
+ sprintf(title, "%d.", i + 1);
+ if( !getdata_buf(2, 11, title, genbuf, 5, DOECHO) )
+ break;
+ sprintf(posttype + i * 4, "%-4.4s", genbuf);
+ if( posttype_f & (1<<i) ){
+ if( getdata(2, 20, "�]�w�d���榡�H(Y/n)", genbuf, 3, LCECHO) &&
+ genbuf[0]=='n' ){
+ posttype_f &= ~(1<<i);
+ continue;
+ }
+ }
+ else if ( !getdata(2, 20, "�]�w�d���榡�H(y/N)", genbuf, 3, LCECHO) ||
+ genbuf[0] != 'y' )
+ continue;
setbnfile(filepath, bp->brdname, "postsample", i);
aborted = vedit(filepath, NA, NULL);
@@ -843,9 +850,9 @@ b_posttype(int ent, fileheader_t * fhdr, char *direct)
clear();
posttype_f &= ~(1<<i);
continue;
- }
+ }
posttype_f |= (1<<i);
- }
+ }
bp->posttype_f = posttype_f;
strncpy(bp->posttype, posttype, 32); /* �o�����ӭn��race condition */
@@ -887,7 +894,8 @@ edit_post(int ent, fileheader_t * fhdr, char *direct)
if (fhdr->filemode&FILE_BOTTOM && strcmp(bp->brdname, "Security") == 0)
return DONOTHING;
- if (!HAS_PERM(PERM_SYSOP) && ((bp->brdattr & BRD_VOTEBOARD) || fhdr->filemode & FILE_VOTE))
+ if (!HAS_PERM(PERM_SYSOP) &&
+ ((bp->brdattr & BRD_VOTEBOARD) || fhdr->filemode & FILE_VOTE))
return DONOTHING;
if( !HAS_PERM(PERM_SYSOP) &&
@@ -912,11 +920,11 @@ edit_post(int ent, fileheader_t * fhdr, char *direct)
if (vedit(fpath, 0, NULL) != -1) {
Rename(fpath, genbuf);
- if(strcmp(save_title, fhdr->title)) // Ptt: here is the black hole problem
- {
- strcpy(fhdr->title, save_title);
- substitute_ref_record(direct, fhdr, ent);
- }
+ if(strcmp(save_title, fhdr->title)){
+ // Ptt: here is the black hole problem
+ strcpy(fhdr->title, save_title);
+ substitute_ref_record(direct, fhdr, ent);
+ }
}
return FULLUPDATE;
}
@@ -926,13 +934,13 @@ edit_post(int ent, fileheader_t * fhdr, char *direct)
static int
cross_post(int ent, fileheader_t * fhdr, char *direct)
{
- char xboard[20], fname[80], xfpath[80], xtitle[80], inputbuf[10];
+ char xboard[20], fname[80], xfpath[80], xtitle[80];
+ char inputbuf[10], genbuf[200], genbuf2[4];
fileheader_t xfile;
FILE *xptr;
int author = 0;
- char genbuf[200];
- char genbuf2[4];
boardheader_t *bp;
+
if (!CheckPostPerm()) {
move(5, 10);
outs("�藍�_�A�z�ثe�L�k����峹�I");
@@ -1032,6 +1040,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct)
}
return FULLUPDATE;
}
+
static int
read_post(int ent, fileheader_t * fhdr, char *direct)
{
@@ -1049,32 +1058,29 @@ read_post(int ent, fileheader_t * fhdr, char *direct)
brc_addlist(fhdr->filename);
strncpy(currtitle, subject(fhdr->title), TTLEN);
- if (more_result)
- {
- if(more_result == 999)
- {
- if (CheckPostPerm()) {
- strlcpy(quote_file, genbuf, sizeof(quote_file));
- do_reply(fhdr);
- *quote_file = 0;
- }
- return FULLUPDATE;
- }
- if(more_result == 998)
- {
+ if (more_result) {
+ if(more_result == 999) {
+ if (CheckPostPerm()) {
+ strlcpy(quote_file, genbuf, sizeof(quote_file));
+ do_reply(fhdr);
+ *quote_file = 0;
+ }
+ return FULLUPDATE;
+ }
+ if(more_result == 998) {
recommend(ent, fhdr, direct);
return FULLUPDATE;
- }
+ }
else return more_result;
- }
-return FULLUPDATE;
+ }
+ return FULLUPDATE;
}
/* ----------------------------------------------------- */
/* �Ķ���ذ� */
/* ----------------------------------------------------- */
static int
-b_man()
+b_man(void)
{
char buf[64];
@@ -1196,7 +1202,7 @@ hold_gamble(int ent, fileheader_t * fhdr, char *direct)
);
strcat(msg, genbuf);
outs("�Ш̦���J�m���W��, �ݴ���2~8��. (�����K��, ��J������enter)\n");
- for (i = 0; i < 8; i++) {
+ for( i = 0 ; i < 8 ; ++i ){
snprintf(yn, sizeof(yn), " %d)", i + 1);
getdata(7 + i, 0, yn, genbuf, 9, DOECHO);
if (!genbuf[0] && i > 1)
@@ -1302,11 +1308,13 @@ recommend_cancel(int ent, fileheader_t * fhdr, char *direct)
substitute_ref_record(direct, fhdr, ent);
return FULLUPDATE;
}
+
static int
-do_add_recommend(char *direct, fileheader_t *fhdr, int ent, char *buf, int type)
+do_add_recommend(char *direct, fileheader_t *fhdr,
+ int ent, char *buf, int type)
{
char path[256];
- int update=0;
+ int update = 0;
/*
race here:
���F��� system calls , �{�b������e������� +1 �g�J .DIR ��.
@@ -1335,43 +1343,43 @@ do_add_recommend(char *direct, fileheader_t *fhdr, int ent, char *buf, int type)
if( (fd = open(direct, O_RDWR)) < 0 )
return -1;
if( lseek(fd, (off_t)(sizeof(fileheader_t) * (ent - 1) +
- (int)&fhdr->recommend - (int)fhdr), SEEK_SET) >= 0)
+ (int)&fhdr->recommend - (int)fhdr),
+ SEEK_SET) >= 0 ){
// �p�G lseek ���ѴN���| write
- {
read(fd, &fhdr->recommend, sizeof(char));
fhdr->recommend += update;
lseek(fd, -1, SEEK_CUR);
write(fd, &fhdr->recommend, sizeof(char));
- }
-
+ }
close(fd);
}
return 0;
}
+
static int
-do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct tm *ptime)
+do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp,
+ char *direct, struct tm *ptime)
{
char genbuf[200], fpath[256],say[30],*money;
bid_t bidinfo;
- int mymax, next;
+ int mymax, next;
setdirpath(fpath, direct, fhdr->filename);
- strcat(fpath,".bid");
+ strcat(fpath, ".bid");
get_record(fpath, &bidinfo, sizeof(bidinfo), 1);
- move(18,0); clrtobot();
+ move(18,0);
+ clrtobot();
prints("�v�ХD�D: %s\n", fhdr->title);
print_bidinfo(0, bidinfo);
- if(!bidinfo.payby) money="Ptt$ "; else money=" NT$ ";
- if(now>bidinfo.enddate || bidinfo.high==bidinfo.buyitnow)
- {
+ money = bidinfo.payby ? " NT$ " : "Ptt$ ";
+ if( now > bidinfo.enddate || bidinfo.high == bidinfo.buyitnow ){
outs("���v�Фw�g����,");
- if( bidinfo.userid[0]) {
+ if( bidinfo.userid[0] ) {
/*if(!payby && bidinfo.usermax!=-1)
{�HPtt���۰ʦ���
}*/
- prints("���� %s �H %d �o��!", bidinfo.userid,
- bidinfo.high);
+ prints("���� %s �H %d �o��!", bidinfo.userid, bidinfo.high);
#ifdef ASSESS
if (!(bidinfo.flag & SALE_COMMENTED) && strcmp(bidinfo.userid, currutmp->userid) == 0){
char tmp = getans("�z���o������������p��? 1:�� 2:���� 3:���q[Q]");
@@ -1395,95 +1403,89 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t
pressanykey();
return FULLUPDATE;
}
- if(bidinfo.userid[0])
- {
+
+ if( bidinfo.userid[0] ){
prints("�U���X���ܤ֭n:%s%d", money,bidinfo.high + bidinfo.increment);
- if(bidinfo.buyitnow)
+ if( bidinfo.buyitnow )
prints(" (��J %d ����H�����ʶR����)",bidinfo.buyitnow);
- next=bidinfo.high + bidinfo.increment;
+ next = bidinfo.high + bidinfo.increment;
}
- else
- {
+ else{
prints("�_�л�: %d", bidinfo.high);
next=bidinfo.high;
}
- if(!strcmp(cuser.userid,bidinfo.userid))
- {
+ if( !strcmp(cuser.userid,bidinfo.userid) ){
outs("�A�O�̰��o�Ъ�!");
pressanykey();
return FULLUPDATE;
}
- if (strcmp(cuser.userid, fhdr->owner) == 0){
+ if( strcmp(cuser.userid, fhdr->owner) == 0 ){
vmsg("ĵ�i! ���H����X��!");
return FULLUPDATE;
}
- getdata_str(23,0,"�O�_�n�U��? (y/N)", genbuf, 3, LCECHO,"n");
- if(genbuf[0]!='y') return FULLUPDATE;
+ getdata_str(23, 0, "�O�_�n�U��? (y/N)", genbuf, 3, LCECHO,"n");
+ if( genbuf[0] != 'y' )
+ return FULLUPDATE;
getdata(23, 0, "�z���̰��U�Ъ��B(0:����):", genbuf, 10, LCECHO);
-
- mymax=atoi(genbuf);
+ mymax = atoi(genbuf);
getdata(23,0,"�U�зP��:",say,12,DOECHO);
-
get_record(fpath, &bidinfo, sizeof(bidinfo), 1);
- if(bidinfo.buyitnow && mymax>bidinfo.buyitnow)
- mymax=bidinfo.buyitnow;
- else if(!bidinfo.userid[0])
- next=bidinfo.high;
+ if( bidinfo.buyitnow && mymax > bidinfo.buyitnow )
+ mymax = bidinfo.buyitnow;
+ else if( !bidinfo.userid[0] )
+ next = bidinfo.high;
else
- next=bidinfo.high + bidinfo.increment;
+ next = bidinfo.high + bidinfo.increment;
- if(mymax< next || (bidinfo.payby==0 && cuser.money<mymax ))
- {
+ if( mymax< next || (bidinfo.payby == 0 && cuser.money < mymax) ){
vmsg("�����U�ЩμЪ������m��");
return FULLUPDATE;
}
snprintf(genbuf, sizeof(genbuf),
- "\033[1;31m�� \033[33m%s\033[m\033[33m:%s\033[m%*s %s%-15d��%15s %02d/%02d\n",
+ "\033[1;31m�� \033[33m%s\033[m\033[33m:%s\033[m%*s %s%-15d��%15s %02d/%02d\n",
cuser.userid,say,
31 - strlen(cuser.userid) - strlen(say), " ",
money,
next, fromhost,
ptime->tm_mon + 1, ptime->tm_mday);
do_add_recommend(direct, fhdr, ent, genbuf, 0);
- if(next > bidinfo.usermax)
- {
- bidinfo.usermax=mymax;
- bidinfo.high=next;
- strcpy(bidinfo.userid,cuser.userid);
- }
- else if(mymax>bidinfo.usermax)
- {
- bidinfo.high=bidinfo.usermax+bidinfo.increment;
- if(bidinfo.high>mymax) bidinfo.high=mymax;
- bidinfo.usermax=mymax;
- strcpy(bidinfo.userid,cuser.userid);
+ if( next > bidinfo.usermax ){
+ bidinfo.usermax = mymax;
+ bidinfo.high = next;
+ strcpy(bidinfo.userid, cuser.userid);
+ }
+ else if( mymax > bidinfo.usermax ) {
+ bidinfo.high = bidinfo.usermax + bidinfo.increment;
+ if( bidinfo.high > mymax )
+ bidinfo.high = mymax;
+ bidinfo.usermax = mymax;
+ strcpy(bidinfo.userid, cuser.userid);
snprintf(genbuf, sizeof(genbuf),
-"\033[1;31m�� \033[33m�۰��v��%s�ӥX\033[m\033[33m\033[m%*s%s%-15d�� %02d/%02d\n",
- cuser.userid,
- 20 - strlen(cuser.userid) , " ",money,
- bidinfo.high,
- ptime->tm_mon + 1, ptime->tm_mday);
+ "\033[1;31m�� \033[33m�۰��v��%s�ӥX\033[m\033[33m\033[m%*s%s%-15d�� %02d/%02d\n",
+ cuser.userid,
+ 20 - strlen(cuser.userid) , " ",money,
+ bidinfo.high,
+ ptime->tm_mon + 1, ptime->tm_mday);
do_add_recommend(direct, fhdr, ent, genbuf, 0);
}
- else
- {
- if(mymax+bidinfo.increment<bidinfo.usermax)
- bidinfo.high=mymax+bidinfo.increment;
+ else {
+ if( mymax + bidinfo.increment < bidinfo.usermax )
+ bidinfo.high = mymax + bidinfo.increment;
else
- bidinfo.high=bidinfo.usermax; /*�o��ǩǪ�*/
+ bidinfo.high=bidinfo.usermax; /*�o��ǩǪ�*/
snprintf(genbuf, sizeof(genbuf),
-"\033[1;31m�� \033[33m�۰��v��%s�ӥX\033[m\033[33m\033[m%*s%s%-15d�� %02d/%02d\n",
- bidinfo.userid,
- 20 - strlen(bidinfo.userid) , " ", money,
- bidinfo.high,
- ptime->tm_mon + 1, ptime->tm_mday);
- do_add_recommend(direct, fhdr, ent, genbuf, 0);
+ "\033[1;31m�� \033[33m�۰��v��%s�ӥX\033[m\033[33m\033[m%*s%s%-15d�� %02d/%02d\n",
+ bidinfo.userid,
+ 20 - strlen(bidinfo.userid) , " ", money,
+ bidinfo.high,
+ ptime->tm_mon + 1, ptime->tm_mday);
+ do_add_recommend(direct, fhdr, ent, genbuf, 0);
}
substitute_record(fpath, &bidinfo, sizeof(bidinfo), 1);
vmsg("���߱z! �H�̰����m�Ч���!");
@@ -1532,17 +1534,19 @@ recommend(int ent, fileheader_t * fhdr, char *direct)
if (fhdr->recommend == 0 && strcmp(cuser.userid, fhdr->owner) == 0){
mouts(b_lines-1, 0, "���H���˩μN�Ĥ@��, ��H �� �[���覡");
type = 2;
- }
+ }
#ifndef DEBUG
if (!(currmode & MODE_BOARD)&& now - lastrecommend < 90) {
mouts(b_lines-1, 0,"���ˮɶ��Ӫ�, ��H �� �[���覡");
type = 2;
}
#endif
- if(type > 2 || type < 0) type = 0;
+ if(type > 2 || type < 0)
+ type = 0;
- if (!getdata(b_lines - 2, 0, "�n������:", path, 40, DOECHO) ||
- path == NULL || getans("�T�w�n\033[%s\033[m��? �ХJ�ӦҼ{(Y/N)?[n]", ctype[type])!='y')
+ if( !getdata(b_lines - 2, 0, "�n������:", path, 40, DOECHO) ||
+ path == NULL ||
+ getans("�T�w�n\033[%s\033[m��? �ХJ�ӦҼ{(Y/N)?[n]", ctype[type]) != 'y')
return FULLUPDATE;
#ifdef OLDRECOMMEND
@@ -1688,7 +1692,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
if (currmode & MODE_SELECT) {
vmsg("�Ц^��@��Ҧ��A�R���峹");
return DONOTHING;
- }
+ }
getdata(1, 0, msg_del_ny, genbuf, 3, LCECHO);
if (genbuf[0] == 'y') {
if(
@@ -1990,7 +1994,8 @@ b_post_note()
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, sizeof(yn), LCECHO);
+ getdata(b_lines - 2, 0, "�O�_�n�Φۭqpost�`�N�ƶ�?",
+ yn, sizeof(yn), LCECHO);
if (yn[0] == 'y')
vedit(buf, NA, NULL);
else
@@ -2000,7 +2005,8 @@ b_post_note()
setbfile(buf, currboard, FN_POST_BID);
if (more(buf, NA) == -1)
more("etc/" FN_POST_BID, NA);
- getdata(b_lines - 2, 0, "�O�_�n�Φۭq�v�Ф峹�`�N�ƶ�?", yn, sizeof(yn), LCECHO);
+ getdata(b_lines - 2, 0, "�O�_�n�Φۭq�v�Ф峹�`�N�ƶ�?",
+ yn, sizeof(yn), LCECHO);
if (yn[0] == 'y')
vedit(buf, NA, NULL);
else
@@ -2013,7 +2019,7 @@ b_post_note()
static int
-can_vote_edit()
+can_vote_edit(void)
{
if (currmode & MODE_BOARD) {
friend_edit(FRIEND_CANVOTE);
@@ -2023,7 +2029,7 @@ can_vote_edit()
}
static int
-bh_title_edit()
+bh_title_edit(void)
{
boardheader_t *bp;
@@ -2048,7 +2054,7 @@ bh_title_edit()
}
static int
-b_notes()
+b_notes(void)
{
char buf[64];
@@ -2063,7 +2069,7 @@ b_notes()
}
int
-board_select()
+board_select(void)
{
char fpath[80];
char genbuf[100];
@@ -2080,7 +2086,7 @@ board_select()
}
int
-board_digest()
+board_digest(void)
{
if (currmode & MODE_SELECT)
board_select();
@@ -2096,7 +2102,7 @@ board_digest()
static int
-push_bottom(int ent, fileheader_t * fhdr, char *direct)
+push_bottom(int ent, fileheader_t *fhdr, char *direct)
{
int num;
char buf[256];
@@ -2104,26 +2110,23 @@ push_bottom(int ent, fileheader_t * fhdr, char *direct)
return DONOTHING;
setbottomtotal(currbid); // <- Ptt : will be remove when stable
num = getbottomtotal(currbid);
- if(getans(fhdr->filemode & FILE_BOTTOM ?
- "�����m�����i?(y/N)":
- "�[�J�m�����i?(y/N)")!='y') return READ_REDRAW;
+ if( getans(fhdr->filemode & FILE_BOTTOM ?
+ "�����m�����i?(y/N)":
+ "�[�J�m�����i?(y/N)") != 'y' )
+ return READ_REDRAW;
fhdr->filemode ^= FILE_BOTTOM;
- if(fhdr->filemode & FILE_BOTTOM )
- {
+ if(fhdr->filemode & FILE_BOTTOM ){
sprintf(buf, "%s.bottom", direct);
- if(num >= 5)
- {
+ if(num >= 5){
vmsg("���o�W�L 5 �g���n���i �к�²!");
return READ_REDRAW;
- }
+ }
fhdr->money = ent | FHR_REFERENCE;
append_record(buf, fhdr, sizeof(fileheader_t));
-
- }
- else
- {
- num = delete_record(direct, sizeof(fileheader_t), ent);
- }
+ }
+ else{
+ num = delete_record(direct, sizeof(fileheader_t), ent);
+ }
setbottomtotal(currbid);
return DIRCHANGED;
}
@@ -2228,7 +2231,7 @@ static char * const board_help[] = {
};
static int
-b_help()
+b_help(void)
{
show_help(board_help);
return FULLUPDATE;
@@ -2423,7 +2426,7 @@ const onekey_t read_comms[] = {
};
int
-Read()
+Read(void)
{
int mode0 = currutmp->mode;
int stat0 = currstat, tmpbid = currutmp->brc_id;
@@ -2432,7 +2435,7 @@ Read()
time_t usetime = now;
#endif
- if ( ! currboard[0] )
+ if ( !currboard[0] )
brc_initial_board(DEFAULT_BOARD);
setutmpmode(READING);
@@ -2462,7 +2465,7 @@ Read()
}
void
-ReadSelect()
+ReadSelect(void)
{
int mode0 = currutmp->mode;
int stat0 = currstat;
@@ -2489,18 +2492,18 @@ log_board(char *mode, time_t usetime)
#endif
int
-Select()
+Select(void)
{
char genbuf[200];
do_select(0, NULL, genbuf);
return 0;
}
+
#ifdef HAVEMOBILE
void
mobile_message(char *mobile, char *message)
{
bsmtp(char *fpath, char *title, char *rcpt, int method);
}
-
#endif