summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-05-18 20:58:51 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-05-18 20:58:51 +0800
commit893f1cf4813ae171c5e18b6b257bad59a314eba8 (patch)
tree7860d8d64886c34c021ed836e18da20e3ab95fc4
parentda0575f3a383237dc9192d1c7ea54c7df9a8c8a6 (diff)
downloadpttbbs-893f1cf4813ae171c5e18b6b257bad59a314eba8.tar
pttbbs-893f1cf4813ae171c5e18b6b257bad59a314eba8.tar.gz
pttbbs-893f1cf4813ae171c5e18b6b257bad59a314eba8.tar.bz2
pttbbs-893f1cf4813ae171c5e18b6b257bad59a314eba8.tar.lz
pttbbs-893f1cf4813ae171c5e18b6b257bad59a314eba8.tar.xz
pttbbs-893f1cf4813ae171c5e18b6b257bad59a314eba8.tar.zst
pttbbs-893f1cf4813ae171c5e18b6b257bad59a314eba8.zip
s/\\n// foreach vmsg("xxx")
indent some code git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2000 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c112
-rw-r--r--mbbsd/chicken.c2
-rw-r--r--mbbsd/mbbsd.c2
-rw-r--r--mbbsd/register.c6
4 files changed, 57 insertions, 65 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index e9d92805..d448bbc0 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -533,54 +533,51 @@ do_general(int isbid)
#endif
#endif
- if(!isbid)
+ if(likely(!isbid))
setbfile(genbuf, currboard, FN_POST_NOTE);
else
setbfile(genbuf, currboard, FN_POST_BID);
- if (more(genbuf, NA) == -1)
- {
- if(!isbid)
- more("etc/" FN_POST_NOTE, NA);
- else
- more("etc/" FN_POST_BID, NA);
- }
+ if (more(genbuf, NA) == -1) {
+ if(!isbid)
+ more("etc/" FN_POST_NOTE, NA);
+ else
+ more("etc/" FN_POST_BID, NA);
+ }
move(19, 0);
prints("%s於【\033[33m %s\033[m 】 \033[32m%s\033[m 看板\n",
isbid?"公開招標":"發表文章",
currboard, bp->title + 7);
- if(isbid)
- {
+ if (unlikely(isbid)) {
memset(&bidinfo,0,sizeof(bidinfo));
- setupbidinfo(&bidinfo);
- postfile.money=bidinfo.high;
- move(20,0);
- clrtobot();
- }
+ setupbidinfo(&bidinfo);
+ postfile.money=bidinfo.high;
+ move(20,0);
+ clrtobot();
+ }
if (quote_file[0])
do_reply_title(20, currtitle);
else {
- if(!isbid)
- {
- move(21,0);
- prints("種類:");
- for(i=0; i<8 && bp->posttype[i*4]; i++)
- strncpy(ctype[i],bp->posttype+4*i,4);
- if(i==0) i=8;
- for(aborted=0; aborted<i; aborted++)
- prints("%d.%4.4s ", aborted+1, ctype[aborted]);
- sprintf(buf,"(1-%d或不選)",i);
- getdata(21, 6+7*i, buf, save_title, 3, LCECHO);
- posttype = save_title[0] - '1';
- if (posttype >= 0 && posttype < i)
- snprintf(save_title, sizeof(save_title),
- "[%s] ", ctype[posttype]);
- else
- {
- save_title[0] = '\0';
- posttype=-1;
- }
+ if (!isbid) {
+ move(21,0);
+ prints("種類:");
+ for(i=0; i<8 && bp->posttype[i*4]; i++)
+ strncpy(ctype[i],bp->posttype+4*i,4);
+ if(i==0) i=8;
+ for(aborted=0; aborted<i; aborted++)
+ prints("%d.%4.4s ", aborted+1, ctype[aborted]);
+ sprintf(buf,"(1-%d或不選)",i);
+ getdata(21, 6+7*i, buf, save_title, 3, LCECHO);
+ posttype = save_title[0] - '1';
+ if (posttype >= 0 && posttype < i)
+ snprintf(save_title, sizeof(save_title),
+ "[%s] ", ctype[posttype]);
+ else
+ {
+ save_title[0] = '\0';
+ posttype=-1;
+ }
}
getdata_buf(22, 0, "標題:", save_title, TTLEN, DOECHO);
strip_ansi(save_title, save_title, STRIP_ALL);
@@ -600,20 +597,17 @@ do_general(int isbid)
/* build filename */
setbpath(fpath, currboard);
stampfile(fpath, &postfile);
- if(isbid)
- {
- aborted = (int)fopen(fpath, "w");
- if(aborted)
- {
- print_bidinfo((FILE*)aborted, bidinfo);
- fclose((FILE*)aborted);
- }
- }
- else if(posttype!=-1 && ((1<<posttype) & bp->posttype_f))
- {
- setbnfile(genbuf, bp->brdname, "postsample", posttype);
- Copy(genbuf, fpath);
- }
+ if(isbid) {
+ aborted = (int)fopen(fpath, "w");
+ if(aborted) {
+ print_bidinfo((FILE*)aborted, bidinfo);
+ fclose((FILE*)aborted);
+ }
+ }
+ else if(posttype!=-1 && ((1<<posttype) & bp->posttype_f)) {
+ setbnfile(genbuf, bp->brdname, "postsample", posttype);
+ Copy(genbuf, fpath);
+ }
aborted = vedit(fpath, YEA, &islocal);
if (aborted == -1) {
@@ -641,11 +635,10 @@ do_general(int isbid)
#endif
/* 錢 */
aborted = (aborted > MAX_POST_MONEY * 2) ? MAX_POST_MONEY : aborted / 2;
- if(ifuseanony)
- {
- postfile.filemode |= FILE_ANONYMOUS;
- postfile.money = currutmp->uid;
- }
+ if(ifuseanony) {
+ postfile.filemode |= FILE_ANONYMOUS;
+ postfile.money = currutmp->uid;
+ }
else if(!isbid)
postfile.money = aborted;
@@ -655,12 +648,11 @@ do_general(int isbid)
postfile.filemode |= FILE_LOCAL;
setbdir(buf, currboard);
- if(isbid)
- {
- sprintf(genbuf, "%s.bid", fpath);
- append_record(genbuf,(void*) &bidinfo, sizeof(bidinfo));
- postfile.filemode |= FILE_BID ;
- }
+ if(isbid) {
+ sprintf(genbuf, "%s.bid", fpath);
+ append_record(genbuf,(void*) &bidinfo, sizeof(bidinfo));
+ postfile.filemode |= FILE_BID ;
+ }
if (append_record(buf, &postfile, sizeof(postfile)) != -1) {
setbtotal(currbid);
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c
index 78bcf358..c95bc423 100644
--- a/mbbsd/chicken.c
+++ b/mbbsd/chicken.c
@@ -126,7 +126,7 @@ new_chicken()
reload_money();
price = egg_price[(int)mychicken->type];
if (cuser.money < price) {
- vmsg("\n 錢不夠買蛋蛋,蛋蛋要 %d 元", price);
+ vmsg("錢不夠買蛋蛋,蛋蛋要 %d 元", price);
return 0;
}
vice(price, "寵物蛋");
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 32bda2f8..47b9fd4a 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -452,7 +452,7 @@ multi_user_check()
} else {
/* allow multiple guest user */
if (search_ulistn(usernum, 100) != NULL) {
- vmsg("\n抱歉,目前已有太多 guest 在站上, 請用new註冊。\n");
+ vmsg("抱歉,目前已有太多 guest 在站上, 請用new註冊。");
exit(1);
}
}
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 71d653a2..10e995c8 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -201,7 +201,7 @@ new_register()
if( passbuf[0] == 'y' )
break;
if( passbuf[0] == 'n' ){
- vmsg("\n抱歉, 您須要接受使用者條款才能註冊帳號享受我們的服務唷!");
+ vmsg("抱歉, 您須要接受使用者條款才能註冊帳號享受我們的服務唷!");
exit(1);
}
vmsg("請輸入 y表示接受, n表示不接受");
@@ -212,7 +212,7 @@ new_register()
try = 0;
while (1) {
if (++try >= 6) {
- vmsg("\n您嘗試錯誤的輸入太多,請下次再來吧\n");
+ vmsg("您嘗試錯誤的輸入太多,請下次再來吧");
exit(1);
}
getdata(17, 0, msg_uid, newuser.userid,
@@ -234,7 +234,7 @@ new_register()
try = 0;
while (1) {
if (++try >= 6) {
- vmsg("\n您嘗試錯誤的輸入太多,請下次再來吧\n");
+ vmsg("您嘗試錯誤的輸入太多,請下次再來吧");
exit(1);
}
if ((getdata(19, 0, "請設定密碼:", passbuf,