diff options
-rw-r--r-- | include/modes.h | 2 | ||||
-rw-r--r-- | include/proto.h | 1 | ||||
-rw-r--r-- | mbbsd/admin.c | 14 | ||||
-rw-r--r-- | mbbsd/announce.c | 7 | ||||
-rw-r--r-- | mbbsd/bbs.c | 40 | ||||
-rw-r--r-- | mbbsd/board.c | 23 | ||||
-rw-r--r-- | mbbsd/cal.c | 54 | ||||
-rw-r--r-- | mbbsd/card.c | 48 | ||||
-rw-r--r-- | mbbsd/chicken.c | 13 | ||||
-rw-r--r-- | mbbsd/dark.c | 36 | ||||
-rw-r--r-- | mbbsd/edit.c | 3 | ||||
-rw-r--r-- | mbbsd/gamble.c | 4 | ||||
-rw-r--r-- | mbbsd/io.c | 2 | ||||
-rw-r--r-- | mbbsd/mail.c | 67 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 18 | ||||
-rw-r--r-- | mbbsd/name.c | 14 | ||||
-rw-r--r-- | mbbsd/read.c | 13 | ||||
-rw-r--r-- | mbbsd/register.c | 21 | ||||
-rw-r--r-- | mbbsd/screen.c | 2 | ||||
-rw-r--r-- | mbbsd/talk.c | 22 | ||||
-rw-r--r-- | mbbsd/vote.c | 3 | ||||
-rw-r--r-- | mbbsd/xyz.c | 6 |
22 files changed, 116 insertions, 297 deletions
diff --git a/include/modes.h b/include/modes.h index 16d23754..1a180055 100644 --- a/include/modes.h +++ b/include/modes.h @@ -13,7 +13,7 @@ #define READ_REDRAW 9 #define PART_REDRAW 10 #define TITLE_REDRAW 11 -#define POS_NEXT 101 /* cursor_pos(locmem, locmem->crs_ln + 1, 1);*/ +#define READ_SKIP 12 /* user 操作狀態與模式 */ #define IDLE 0 diff --git a/include/proto.h b/include/proto.h index 82865f8d..097829b7 100644 --- a/include/proto.h +++ b/include/proto.h @@ -459,7 +459,6 @@ void clrtoeol(void); void clear(void); void refresh(void); void clrtobot(void); -void mprints(int y, int x, char *str); void outmsg(char *msg); void region_scroll_up(int top, int bottom); void outc(unsigned char ch); diff --git a/mbbsd/admin.c b/mbbsd/admin.c index 53140e27..02bab271 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -134,7 +134,6 @@ search_key_user(char *passwdfile, int mode) fclose(fp1); return 0; } else { - move(b_lines - 1, 0); getdata(0, 0, "目前的 PASSWD 檔沒有此 ID,新增嗎?[y/N]", genbuf, 3, LCECHO); @@ -955,15 +954,13 @@ scan_register_form(char *regfile, int automode, int neednum) prints("%d.%-12s:%s\n", n - 2, finfo[n], fdata[n]); } if (muser.userlevel & PERM_LOGINOK) { - getdata(b_lines - 1, 0, "\033[1;32m此帳號已經完成註冊, " - "更新(Y/N/Skip)?\033[m[N] ", ans, sizeof(ans), LCECHO); + ans[0]=getans("此帳號已經完成註冊, " + "更新(Y/N/Skip)?[N] "); if (ans[0] != 'y' && ans[0] != 's') ans[0] = 'd'; } else { - move(b_lines - 1, 0); - prints("是否接受此資料(Y/N/Q/Del/Skip)?[S] "); if (search_ulist(unum) == NULL) - ans[0] = igetch(); + ans[0] = getans("是否接受此資料(Y/N/Q/Del/Skip)?[S] "); else ans[0] = 's'; if ('A' <= ans[0] && ans[0] <= 'Z') @@ -1161,10 +1158,9 @@ cat_register() { if (system("cat register.new.tmp >> register.new") == 0 && system("rm -f register.new.tmp") == 0) - mprints(22, 0, "OK 嚕~~ 繼續去奮鬥吧!!"); + vmsg(22, 0, "OK 嚕~~ 繼續去奮鬥吧!!"); else - mprints(22, 0, "沒辦法CAT過去呢 去檢查一下系統吧!!"); - pressanykey(); + vmsg(22, 0, "沒辦法CAT過去呢 去檢查一下系統吧!!"); return 0; } diff --git a/mbbsd/announce.c b/mbbsd/announce.c index 21696789..30fe76f3 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -317,8 +317,7 @@ a_pasteitem(menu_t * pm, int mode) if (dashd(copyfile)) { for (i = 0; copyfile[i] && copyfile[i] == pm->path[i]; i++); if (!copyfile[i]) { - outs("將目錄拷進自己的子目錄中,會造成無窮迴圈!"); - igetch(); + vmsg("將目錄拷進自己的子目錄中,會造成無窮迴圈!"); return; } } @@ -682,9 +681,7 @@ a_showname(menu_t * pm) sym = 1; } if (sym) { - pressanykey(); - move(b_lines - 1, 1); - prints("此 symbolic link 指向 %s\n", &buf[i + 1]); + vmsg("此 symbolic link 指向 %s\n", &buf[i + 1]); } } } diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index a079c11a..4bf0fab4 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -57,7 +57,7 @@ save_violatelaw() stand_title("繳罰單中心"); if (!(cuser.userlevel & PERM_VIOLATELAW)) { - mprints(22, 0, "\033[1;31m你無聊啊? 你又沒有被開罰單~~\033[m"); + mouts(22, 0, "\033[1;31m你無聊啊? 你又沒有被開罰單~~\033[m"); pressanykey(); return 0; } @@ -66,7 +66,7 @@ save_violatelaw() snprintf(buf, sizeof(buf), "\033[1;31m這是你第 %d 次違反本站法規" "必須繳出 %d $Ptt ,你只有 %d 元, 錢不夠啦!!\033[m", (int)cuser.vl_count, (int)cuser.vl_count * 1000, cuser.money); - mprints(22, 0, buf); + mouts(22, 0, buf); pressanykey(); return 0; } @@ -77,19 +77,19 @@ save_violatelaw() if (!getdata(10, 0, "確定嗎?[y/n]:", ok, sizeof(ok), LCECHO) || ok[0] == 'n' || ok[0] == 'N') { - mprints(22, 0, "\033[1;31m等你想通了再來吧!! " + mouts(22, 0, "\033[1;31m等你想通了再來吧!! " "我相信你不會知錯不改的~~~\033[m"); pressanykey(); return 0; } snprintf(buf, sizeof(buf), "這是你第 %d 次違法 必須繳出 %d $Ptt", cuser.vl_count, cuser.vl_count * 1000); - mprints(11, 0, buf); + mouts(11, 0, buf); if (!getdata(10, 0, "要付錢[y/n]:", ok, sizeof(ok), LCECHO) || ok[0] == 'N' || ok[0] == 'n') { - mprints(22, 0, "\033[1;31m 嗯 存夠錢 再來吧!!!\033[m"); + mouts(22, 0, "\033[1;31m 嗯 存夠錢 再來吧!!!\033[m"); pressanykey(); return 0; } @@ -1129,12 +1129,12 @@ read_post(int ent, fileheader_t * fhdr, char *direct) int more_result; if (fhdr->owner[0] == '-') - return DONOTHING; + return READ_SKIP; setdirpath(genbuf, direct, fhdr->filename); if ((more_result = more(genbuf, YEA)) == -1) - return FULLUPDATE; + return READ_SKIP; brc_addlist(fhdr->filename); strncpy(currtitle, subject(fhdr->title), TTLEN); @@ -1321,9 +1321,7 @@ hold_gamble(int ent, fileheader_t * fhdr, char *direct) openticket(currbid); return FULLUPDATE; } else if (dashf(genbuf)) { - move(b_lines - 1, 0); - prints(" 目前系統正在處理開獎事宜, 請結果出爐後再舉辦......."); - pressanykey(); + vmsg(" 目前系統正在處理開獎事宜, 請結果出爐後再舉辦......."); return FULLUPDATE; } getdata(b_lines - 2, 0, "要舉辦賭盤 (N/y):", yn, 3, LCECHO); @@ -1687,9 +1685,7 @@ recommend(int ent, fileheader_t * fhdr, char *direct) #ifndef DEBUG if (!(currmode & MODE_BOARD) && getuser(cuser.userid) && now - lastrecommend < 40) { - move(b_lines - 1, 0); - prints("離上次推薦時間太近囉, 請多花點時間仔細閱\讀文章!"); - pressanykey(); + vmsg("離上次推薦時間太近囉, 請多花點時間仔細閱\讀文章!"); return FULLUPDATE; } #endif @@ -1933,13 +1929,9 @@ del_post(int ent, fileheader_t * fhdr, char *direct) if (cuser.numposts) cuser.numposts--; if (!(currmode & MODE_DIGEST && currmode & MODE_BOARD)){ - move(b_lines - 1, 0); - clrtoeol(); demoney(-fhdr->money); - prints("%s,您的文章減為 %d 篇,支付清潔費 %d 銀", msg_del_ok, + vmsg("%s,您的文章減為 %d 篇,支付清潔費 %d 銀", msg_del_ok, cuser.numposts, fhdr->money); - refresh(); - pressanykey(); } } return DIRCHANGED; @@ -1953,30 +1945,24 @@ show_filename(int ent, fileheader_t * fhdr, char *direct) { if(!HAS_PERM(PERM_SYSOP)) return DONOTHING; - move(b_lines - 1, 0); - prints("檔案名稱: %s ", fhdr->filename); - pressanykey(); + vmsg("檔案名稱: %s ", fhdr->filename); return PART_REDRAW; } static int view_postmoney(int ent, fileheader_t * fhdr, char *direct) { - move(b_lines - 1, 0); if(currmode & MODE_SELECT){ vmsg("請在離開目前的選擇模式再查詢"); return FULLUPDATE; } - clrtoeol(); if(fhdr->filemode & FILE_ANONYMOUS) /* When the file is anonymous posted, fhdr->money is author. * see do_general() */ - prints("匿名管理編號: %d (同一人被查詢時編號相同, 此編號每人看到不相同)", + vmsg("匿名管理編號: %d (同一人被查詢時編號相同, 此編號每人看到不相同)", fhdr->money + currutmp->pid); else - prints("這一篇文章值 %d 銀", fhdr->money); - refresh(); - pressanykey(); + vmsg("這一篇文章值 %d 銀", fhdr->money); return FULLUPDATE; } diff --git a/mbbsd/board.c b/mbbsd/board.c index 7cfeabd1..dd7dba76 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -432,7 +432,7 @@ show_brdlist(int head, int clsflag, int newflag) if (yank_flag == 0 && get_fav_type(&nbrd[0]) == 0){ move(3, 0); - prints(" --- 空目錄 ---"); + outs(" --- 空目錄 ---"); return; } @@ -468,9 +468,9 @@ show_brdlist(int head, int clsflag, int newflag) } if (class_bid == 1) - prints(" "); + outs(" "); if (!newflag) { - prints("%5d%c%s", head, + outs("%5d%c%s", head, !(B_BH(ptr)->brdattr & BRD_HIDE) ? ' ' : (B_BH(ptr)->brdattr & BRD_POSTMASK) ? ')' : '-', (ptr->myattr & NBRD_TAG) ? "D " : @@ -478,14 +478,14 @@ show_brdlist(int head, int clsflag, int newflag) unread[ptr->myattr & NBRD_UNREAD ? 1 : 0]); } else { if (B_BH(ptr)->brdattr & BRD_GROUPBOARD) - prints(" "); + outs(" "); else prints("%6d%s", (int)(B_TOTAL(ptr)), unread[ptr->myattr & NBRD_UNREAD ? 1 : 0]); } if (class_bid != 1) { if (!GROUPOP() && !HasPerm(B_BH(ptr))) { - prints("Unknown?? 隱板 ?這個板是隱板"); + outs("Unknown?? 隱板 ?這個板是隱板"); } else { prints("%s%-13s\033[m%s%5.5s\033[0;37m%2.2s\033[m" @@ -499,15 +499,15 @@ show_brdlist(int head, int clsflag, int newflag) B_BH(ptr)->title, B_BH(ptr)->title + 5, B_BH(ptr)->title + 7); if (B_BH(ptr)->brdattr & BRD_BAD) - prints(" X "); + outs(" X "); else if (B_BH(ptr)->nuser >= 5000) - prints("\033[1;34m爆!\033[m"); + outs("\033[1;34m爆!\033[m"); else if (B_BH(ptr)->nuser >= 2000) - prints("\033[1;31m爆!\033[m"); + outs("\033[1;31m爆!\033[m"); else if (B_BH(ptr)->nuser >= 1000) - prints("\033[1m爆!\033[m"); + outs("\033[1m爆!\033[m"); else if (B_BH(ptr)->nuser >= 100) - prints("\033[1mHOT\033[m"); + outs("\033[1mHOT\033[m"); else if (B_BH(ptr)->nuser > 50) prints("\033[1;31m%2d\033[m ", B_BH(ptr)->nuser); else if (B_BH(ptr)->nuser > 10) @@ -614,9 +614,8 @@ choose_board(int newflag) load_boards(keyword); if (brdnum <= 0 && yank_flag > 0) { if (keyword[0] != 0) { - mprints(b_lines - 1, 0, "沒有任何看板標題有此關鍵字 " + vmsg("沒有任何看板標題有此關鍵字 " "(板主應注意看板標題命名)"); - pressanykey(); keyword[0] = 0; brdnum = -1; continue; diff --git a/mbbsd/cal.c b/mbbsd/cal.c index dca13c4d..3430ae75 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -96,18 +96,13 @@ osong(char *defaultid) /* Jaky 一人一天點一首 */ if (!strcmp(buf, Cdatedate(&cuser.lastsong)) && !HAS_PERM(PERM_SYSOP)) { move(22, 0); - outs("你今天已經點過囉,明天再點吧...."); - refresh(); - pressanykey(); - + vmsg("你今天已經點過囉,明天再點吧...."); unlockutmpmode(); return 0; } if (cuser.money < 200) { move(22, 0); - outs("點歌要200銀唷!...."); - refresh(); - pressanykey(); + vmsg("點歌要200銀唷!...."); unlockutmpmode(); return 0; } @@ -262,18 +257,12 @@ inmailbox(int m) int p_cloak() { - char buf[4]; - getdata(b_lines - 1, 0, - currutmp->invisible ? "確定要現身?[y/N]" : "確定要隱身?[y/N]", - buf, sizeof(buf), LCECHO); - if (buf[0] != 'y') + if (getans(currutmp->invisible ? "確定要現身?[y/N]" : "確定要隱身?[y/N]") != 'y') return 0; if (cuser.money >= 19) { vice(19, "付費隱身"); currutmp->invisible %= 2; - outs((currutmp->invisible ^= 1) ? MSG_CLOAKED : MSG_UNCLOAK); - refresh(); - safe_sleep(1); + vmsg((currutmp->invisible ^= 1) ? MSG_CLOAKED : MSG_UNCLOAK); } return 0; } @@ -282,10 +271,7 @@ p_cloak() int p_from() { - char ans[4]; - - getdata(b_lines - 2, 0, "確定要改故鄉?[y/N]", ans, sizeof(ans), LCECHO); - if (ans[0] != 'y') + if (getans("確定要改故鄉?[y/N]") != 'y') return 0; reload_money(); if (cuser.money < 49) @@ -305,8 +291,7 @@ p_exmail() int n; if (cuser.exmailbox >= MAX_EXKEEPMAIL) { - prints("容量最多增加 %d 封,不能再買了。", MAX_EXKEEPMAIL); - refresh(); + vmsg("容量最多增加 %d 封,不能再買了。", MAX_EXKEEPMAIL); return 0; } snprintf(buf, sizeof(buf), @@ -393,9 +378,7 @@ p_give() snprintf(genbuf, sizeof(genbuf), "%s\t給%s\t%d\t%s", cuser.userid, id, money - tax, ctime(&now)); log_file(FN_MONEY, genbuf, 1); - genbuf[0] = 'n'; - getdata(3, 0, "要自行書寫紅包袋嗎?[y/N]", genbuf, 2, LCECHO); - mail_redenvelop(cuser.userid, id, money - tax, genbuf[0]); + mail_redenvelop(cuser.userid, id, money - tax, getans("要自行書寫紅包袋嗎?[y/N]")); } return 0; } @@ -444,26 +427,3 @@ p_sysinfo(void) return 0; } -/* 小計算機 */ -#if 0 -static void -ccount(float *a, float b, int cmode) -{ - switch (cmode) { - case 0: - case 1: - case 2: - *a += b; - break; - case 3: - *a -= b; - break; - case 4: - *a *= b; - break; - case 5: - *a /= b; - break; - } -} -#endif diff --git a/mbbsd/card.c b/mbbsd/card.c index 4906e5e9..b46ce2bc 100644 --- a/mbbsd/card.c +++ b/mbbsd/card.c @@ -450,16 +450,12 @@ card_jack(int *db) if ((card_number(me[0]) == 0 && card_number(me[1]) == 12) || (card_number(me[1]) == 0 && card_number(me[0]) == 12)) { if (card_flower(me[0]) == 0 && card_flower(me[1]) == 0) { - move(b_lines - 1, 0); - prints("非常不錯唷! (超級黑傑克!! 加 %d 元)", JACK * 10); game_log(JACK, JACK * 10); - pressanykey(); + vmsg("非常不錯唷! (超級黑傑克!! 加 %d 元)", JACK * 10); return 0; } else { - move(b_lines - 1, 0); - prints("很不錯唷! (黑傑克!! 加 %d 元)", JACK * 5); game_log(JACK, JACK * 5); - pressanykey(); + vmsg("很不錯唷! (黑傑克!! 加 %d 元)", JACK * 5); return 0; } } @@ -467,10 +463,8 @@ card_jack(int *db) (card_number(cpu[1]) == 0 && card_number(cpu[0]) == 12)) { c[0] = 1; card_show(cpu, c, me, m); - move(b_lines - 1, 0); - prints("嘿嘿...不好意思....黑傑克!!"); game_log(JACK, 0); - pressanykey(); + vmsg("嘿嘿...不好意思....黑傑克!!"); return 0; } if ((*db < 0) && (card_number(me[0]) == card_number(me[1])) && @@ -485,27 +479,21 @@ card_jack(int *db) m[i] = 1; card_show(cpu, c, me, m); if (card_alls_lower(me) > 21) { - move(b_lines - 1, 0); - prints("嗚嗚...爆掉了!"); game_log(JACK, 0); - pressanykey(); + vmsg("嗚嗚...爆掉了!"); return 0; } i++; if ((i == 3) && (card_number(me[0]) == 7) && (card_number(me[1]) == 7) && (card_number(me[2]) == 7)) { - move(b_lines - 1, 0); - prints("很不錯唷! (幸運七號!! 加 %d 元)", JACK * 7); game_log(JACK, JACK * 7); - pressanykey(); + vmsg("很不錯唷! (幸運七號!! 加 %d 元)", JACK * 7); return 0; } } if (i == 5) { /* 過五關 */ - move(b_lines - 1, 0); - prints("好厲害唷! 過五關嘍! 加P幣 %d 元!", 5 * JACK); game_log(JACK, JACK * 5); - pressanykey(); + vmsg("好厲害唷! 過五關嘍! 加P幣 %d 元!", 5 * JACK); return 0; } j = 2; @@ -516,19 +504,15 @@ card_jack(int *db) c[j] = 1; if (card_alls_lower(cpu) > 21) { card_show(cpu, c, me, m); - move(b_lines - 1, 0); - prints("呵呵...電腦爆掉了! 你贏了! 可得P幣 %d 元", JACK * 2); game_log(JACK, JACK * 2); - pressanykey(); + vmsg("呵呵...電腦爆掉了! 你贏了! 可得P幣 %d 元", JACK * 2); return 0; } j++; } card_show(cpu, c, me, m); - move(b_lines - 1, 0); - prints("哇哇...電腦贏了!"); game_log(JACK, 0); - pressanykey(); + vmsg("哇哇...電腦贏了!"); return 0; } @@ -595,19 +579,15 @@ ten_helf() m[i] = 1; card_show(cpu, c, me, m); if (card_all(me) > 21) { - move(b_lines - 1, 0); - prints("嗚嗚...爆掉了!"); game_log(TEN_HALF, 0); - pressanykey(); + vmsg("嗚嗚...爆掉了!"); return 0; } i++; } if (i == 5) { /* 過五關 */ - move(b_lines - 1, 0); - prints("好厲害唷! 過五關嘍! 加P幣 %d 元!", 5 * PMONEY); game_log(TEN_HALF, PMONEY * 5); - pressanykey(); + vmsg("好厲害唷! 過五關嘍! 加P幣 %d 元!", 5 * PMONEY); return 0; } j = 1; @@ -618,19 +598,15 @@ ten_helf() c[j] = 1; if (card_all(cpu) > 21) { card_show(cpu, c, me, m); - move(b_lines - 1, 0); - prints("呵呵...電腦爆掉了! 你贏了! 可得P幣 %d 元", PMONEY * 2); game_log(TEN_HALF, PMONEY * 2); - pressanykey(); + vmsg("呵呵...電腦爆掉了! 你贏了! 可得P幣 %d 元", PMONEY * 2); return 0; } j++; } card_show(cpu, c, me, m); - move(b_lines - 1, 0); - prints("哇哇...電腦贏了!"); game_log(TEN_HALF, 0); - pressanykey(); + vmsg("哇哇...電腦贏了!"); return 0; } diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c index bc97cc58..e285856d 100644 --- a/mbbsd/chicken.c +++ b/mbbsd/chicken.c @@ -127,8 +127,7 @@ new_chicken() reload_money(); price = egg_price[(int)mychicken->type]; if (cuser.money < price) { - prints("\n 錢不夠買蛋蛋,蛋蛋要 %d 元", price); - refresh(); + vmsg("\n 錢不夠買蛋蛋,蛋蛋要 %d 元", price); return 0; } vice(price, "寵物蛋"); @@ -400,12 +399,10 @@ ch_buyitem(int money, char *picture, int *item, int haveticket) else demoney(-money * num); show_file(picture, 5, 14, NO_RELOAD); + pressanykey(); } else { - move(b_lines - 1, 0); - clrtoeol(); - outs("現金不夠 !!!"); + vmsg("現金不夠 !!!"); } - pressanykey(); } static void @@ -928,13 +925,11 @@ chickenpk(int fd) memcpy(&ouser, &xuser, sizeof(userec_t)); reload_chicken(); if (!ochicken->name[0] || !mychicken->name[0]) { - outmsg("有一方沒有寵物"); /* Ptt:妨止page時把寵物賣掉 */ bell(); - refresh(); + vmsg("有一方沒有寵物"); /* Ptt:妨止page時把寵物賣掉 */ add_io(0, 0); close(fd); unlockutmpmode(); - sleep(1); return 0; } show_chicken_data(ochicken, mychicken); diff --git a/mbbsd/dark.c b/mbbsd/dark.c index 60f64dbd..65fd85ab 100644 --- a/mbbsd/dark.c +++ b/mbbsd/dark.c @@ -34,7 +34,7 @@ brdswap(sint y, sint x, sint ly, sint lx) } static void -pprints(sint y, sint x, char *s) +mouts(sint y, sint x, char *s) { move(y, x); clrtoeol(); @@ -370,11 +370,11 @@ main_dark(int fd, userinfo_t * uin) if (currutmp->turn) { brd_rand(); send(fd, &brd, sizeof(brd), 0); - pprints(21, 0, " [1;37m[1;33m◆[1;37m你是先手[m"); - pprints(22, 0, " [1;33m◆[5;35m輪到你下了[m"); + mouts(21, 0, " [1;37m[1;33m◆[1;37m你是先手[m"); + mouts(22, 0, " [1;33m◆[5;35m輪到你下了[m"); } else { recv(fd, &brd, sizeof(brd), 0); - pprints(21, 0, " [1;33m◆[1;37m你是後手[m"); + mouts(21, 0, " [1;33m◆[1;37m你是後手[m"); } move(12, 3); prints("%s[0勝0敗][5;31mvs[1;37m.[m%s[0勝0敗]", currutmp->userid, currutmp->mateid); @@ -412,20 +412,20 @@ main_dark(int fd, userinfo_t * uin) break; } if (curr.end == -3) - pprints(23, 30, "\033[33m要求合棋\033[m"); + mouts(23, 30, "\033[33m要求合棋\033[m"); else if (curr.end == -4) - pprints(23, 30, "\033[33m要求換邊\033[m"); + mouts(23, 30, "\033[33m要求換邊\033[m"); else if (curr.end == -5) - pprints(23, 30, "\033[33m要求連吃\033[m"); + mouts(23, 30, "\033[33m要求連吃\033[m"); else - pprints(23, 30, ""); + mouts(23, 30, ""); recv(fd, &brd, sizeof(brd), 0); my = curr.y; mx = curr.x; redraw(); if (curr.end) - pprints(22, 0, " [1;33m◆[5;35m輪到你下了[m"); + mouts(22, 0, " [1;33m◆[5;35m輪到你下了[m"); move(cury[my], curx[mx]); } else { if (currutmp->turn == 'p') { @@ -434,7 +434,7 @@ main_dark(int fd, userinfo_t * uin) currutmp->turn = 'e'; break; } else { - pprints(23, 30, ""); + mouts(23, 30, ""); *buf = 0; currutmp->turn = (uin->turn) ? 0 : 1; } @@ -442,17 +442,17 @@ main_dark(int fd, userinfo_t * uin) if (ch == 'y') { currutmp->color = (currutmp->color == '1') ? '0' : '1'; uin->color = (uin->color == '1') ? '0' : '1'; - pprints(21, 0, (currutmp->color == '1') ? " \033[1;33m◆[1;31m你持紅色棋\033[m" : " \033[1;33m◆[1;36m你持黑色棋\033[m"); + mouts(21, 0, (currutmp->color == '1') ? " \033[1;33m◆[1;31m你持紅色棋\033[m" : " \033[1;33m◆[1;36m你持黑色棋\033[m"); } else { - pprints(23, 30, ""); + mouts(23, 30, ""); currutmp->turn = (uin->turn) ? 0 : 1; } } else if (currutmp->turn == 'g') { if (ch == 'y') { cont = 1; - pprints(21, 0, " \033[1;33m◆[1;31m你持紅色棋\033[m 可連吃"); + mouts(21, 0, " \033[1;33m◆[1;31m你持紅色棋\033[m 可連吃"); } else { - pprints(23, 30, ""); + mouts(23, 30, ""); currutmp->turn = (uin->turn) ? 0 : 1; } } @@ -460,7 +460,7 @@ main_dark(int fd, userinfo_t * uin) if (uin->turn == 'g') { cont = 1; uin->turn = (currutmp->turn) ? 0 : 1; - pprints(21, 10, "可連吃"); + mouts(21, 10, "可連吃"); } end = playing(fd, currutmp->color - '0', ch, &go_on, uin); @@ -493,12 +493,12 @@ main_dark(int fd, userinfo_t * uin) continue; } if (!i && currutmp->color == '1') { - pprints(21, 0, " \033[1;33m◆[1;31m你持紅色棋\033[m"); + mouts(21, 0, " \033[1;33m◆[1;31m你持紅色棋\033[m"); i++; move(cury[my], curx[mx]); } if (!i && currutmp->color == '0') { - pprints(21, 0, " \033[1;33m◆[1;36m你持黑色棋\033[m"); + mouts(21, 0, " \033[1;33m◆[1;36m你持黑色棋\033[m"); i++; move(cury[my], curx[mx]); } @@ -540,7 +540,7 @@ main_dark(int fd, userinfo_t * uin) } break; case -3: - pprints(22, 0, "[1;31m合棋唷!! 下次在分高下吧 ^_^[m"); + mouts(22, 0, "[1;31m合棋唷!! 下次在分高下吧 ^_^[m"); break; default: add_io(0, 0); diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 897c7178..f9cb439a 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -965,8 +965,7 @@ write_file(char *fpath, int saveheader, int *islocal) switch (ans[0]) { case 'a': - outs("文章\033[1m 沒有 \033[m存入"); - safe_sleep(1); + vmsg("文章\033[1m 沒有 \033[m存入"); aborted = -1; break; case 'r': diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c index 33e67bb8..512df7f2 100644 --- a/mbbsd/gamble.c +++ b/mbbsd/gamble.c @@ -159,9 +159,7 @@ ticket(int bid) ch_buyitem(price, "etc/buyticket", &n, 0); if (bid && !dashf(fn_ticket)) { - move(b_lines - 1, 0); - prints("哇!! 耐ㄚ捏...板主已經停止下注了 不能賭嚕"); - pressanykey(); + vmsg("哇!! 耐ㄚ捏...板主已經停止下注了 不能賭嚕"); break; } @@ -126,7 +126,7 @@ dogetch() if (flushf) (*flushf) (); - refresh(); + oflush(); if (i_newfd) { diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 04c54c97..6198004b 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -24,20 +24,14 @@ setforward() getdata(b_lines, 0, "確定開啟自動轉信功\能?(Y/n)", yn, sizeof(yn), LCECHO); if (yn[0] != 'n' && (fp = fopen(buf, "w"))) { - move(b_lines, 0); - clrtoeol(); fprintf(fp, "%s", ip); fclose(fp); - outs("設定完成!"); - refresh(); + vmsg("設定完成!"); return 0; } } - move(b_lines, 0); - clrtoeol(); - outs("取消自動轉信!"); unlink(buf); - refresh(); + vmsg("取消自動轉信!"); return 0; } @@ -163,27 +157,13 @@ chkmailbox() mailmaxkeep = max_keepmail + cuser.exmailbox; m_init(); if ((mailkeep = get_num_records(currmaildir, sizeof(fileheader_t))) > - mailmaxkeep) { - move(b_lines, 0); - clrtoeol(); - bell(); - prints("您保存信件數目 %d 超出上限 %d, 請整理", - mailkeep, mailmaxkeep); + mailmaxkeep || + (mailsum = get_sum_records(currmaildir, sizeof(fileheader_t))) > + mailsumlimit) { bell(); - refresh(); - igetch(); - return mailkeep; - } - if ((mailsum = get_sum_records(currmaildir, sizeof(fileheader_t))) > - mailsumlimit) { - move(b_lines, 0); - clrtoeol(); bell(); - prints("您保存信件容量 %d(k)超出上限 %d(k), 請整理", - mailsum, mailsumlimit); - bell(); - refresh(); - igetch(); + vmsg("您保存信件數目或容量 %d 超出上限 %d, 請整理", + mailkeep, mailmaxkeep); return mailkeep; } } @@ -498,13 +478,9 @@ multi_send(char *title) if (vedit(fpath, YEA, NULL) == -1) { unlink(fpath); curredit = 0; - outs(msg_cancel); - pressanykey(); + vmsg(msg_cancel); return; } - stand_title("寄信中..."); - refresh(); - listing = 80; for (p = toplev; p; p = p->next) { @@ -530,15 +506,14 @@ multi_send(char *title) mymail.filemode |= FILE_MULTI; /* multi-send flag */ sethomedir(genbuf, p->word); if (append_record_forward(genbuf, &mymail, sizeof(mymail)) == -1) - outs(err_uid); + vmsg(err_uid); mailalert(p->word); } hold_mail(fpath, NULL); unlink(fpath); curredit = 0; } else - outs(msg_cancel); - pressanykey(); + vmsg(msg_cancel); } static int @@ -636,8 +611,7 @@ mail_all() outs(err_uid); snprintf(genbuf, sizeof(genbuf), "%*s %5d / %5d", IDLEN + 1, userid, i + 1, unum); - outmsg(genbuf); - refresh(); + vmsg(genbuf); } } return 0; @@ -746,10 +720,7 @@ read_new_mail(fileheader_t * fptr) multi_reply(idc, fptr, currmaildir); return FULLUPDATE; } - move(b_lines, 0); - clrtoeol(); - outs(msg_mailer); - refresh(); + outmsg(msg_mailer); switch (igetch()) { case 'r': @@ -923,10 +894,7 @@ mail_read(int ent, fileheader_t * fhdr, char *direct) multi_reply(ent, fhdr, direct); return FULLUPDATE; } - move(b_lines, 0); - clrtoeol(); - refresh(); - outs(msg_mailer); + outmsg(msg_mailer); switch (igetch()) { case 'r': @@ -1606,8 +1574,7 @@ doforward(char *direct, fileheader_t * fh, int mode) strlcpy(address, cuser.email, sizeof(address)); if( mode == 'U' ){ - move(b_lines, 0); - prints("將進行 uuencode 。若您不清楚什麼是 uuencode 請改用 F轉寄。"); + vmsg("將進行 uuencode 。若您不清楚什麼是 uuencode 請改用 F轉寄。"); } if (address[0]) { @@ -1632,7 +1599,7 @@ doforward(char *direct, fileheader_t * fh, int mode) snprintf(address, sizeof(address), "%s.bbs@%s", fname, MYHOSTNAME); } else { - outmsg("取消轉寄"); + vmsg("取消轉寄"); return 1; } } while (mode == 'Z' && strstr(address, MYHOSTNAME)); @@ -1640,9 +1607,7 @@ doforward(char *direct, fileheader_t * fh, int mode) if (invalidaddr(address)) return -2; - snprintf(fname, sizeof(fname), "正轉寄給 %s, 請稍候...", address); - outmsg(fname); - move(b_lines, 0); + outmsg("正轉寄請稍候..."); refresh(); /* 追蹤使用者 */ diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 2b1db5a8..fe8ad16c 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -183,18 +183,6 @@ u_exit(char *mode) } void -system_abort() -{ - if (currmode) - u_exit("ABORT"); - - clear(); - refresh(); - fprintf(stdout, "謝謝光臨, 記得常來喔 !\n"); - exit(0); -} - -void abort_bbs(int sig) { if (currmode) @@ -473,14 +461,12 @@ multi_user_check() log_usies("KICK ", cuser.username); } else { if (search_ulistn(usernum, 3) != NULL) - system_abort(); /* Goodbye(); */ + abort_bbs(); /* Goodbye(); */ } } else { /* allow multiple guest user */ if (search_ulistn(usernum, 100) != NULL) { - outs("\n抱歉,目前已有太多 guest 在站上, 請用new註冊。\n"); - pressanykey(); - oflush(); + vmsg("\n抱歉,目前已有太多 guest 在站上, 請用new註冊。\n"); exit(1); } } diff --git a/mbbsd/name.c b/mbbsd/name.c index 9d467352..3cb2b698 100644 --- a/mbbsd/name.c +++ b/mbbsd/name.c @@ -264,7 +264,6 @@ namecomplete(char *prompt, char *data) prints("%*s", IDLEN + 1, ""); standend(); move(y, x); - refresh(); while ((ch = igetch()) != EOF) { if (ch == '\n' || ch == '\r') { @@ -309,8 +308,7 @@ namecomplete(char *prompt, char *data) len = MaxLen(morelist, p_lines); } if (morelist) { - move(b_lines, 0); - outs(msg_more); + vmsg(msg_more); } move(y, x); continue; @@ -356,7 +354,6 @@ namecomplete(char *prompt, char *data) raise(SIGHUP); /* jochang: don't know if this is * necessary... */ outc('\n'); - refresh(); if (clearbot) { move(2, 0); clrtobot(); @@ -434,8 +431,7 @@ usercomplete(char *prompt, char *data) len = UserMaxLen((arrptr) cwlist, cwnum, morenum, p_lines); } if (morenum < cwnum) { - move(b_lines, 0); - outs(msg_more); + vmsg(msg_more); } else morenum = 0; move(y, x); @@ -478,7 +474,6 @@ usercomplete(char *prompt, char *data) /* longjmp(byebye, -1); */ raise(SIGHUP); /* jochang: don't know if this is necessary */ outc('\n'); - refresh(); if (clearbot) { move(2, 0); clrtobot(); @@ -561,7 +556,6 @@ generalnamecomplete(char *prompt, char *data, int len, size_t nmemb, prints("%*s", IDLEN + 1, ""); standend(); move(y, x); - refresh(); ptr = 0; data[ptr] = 0; @@ -611,8 +605,7 @@ generalnamecomplete(char *prompt, char *data, int len, size_t nmemb, col += len + 2; } if (morelist != end + 1) { - move(b_lines, 0); - outs(msg_more); + vmsg(msg_more); } move(y, x); continue; @@ -651,7 +644,6 @@ generalnamecomplete(char *prompt, char *data, int len, size_t nmemb, } outc('\n'); - refresh(); if (clearbot) { move(2, 0); clrtobot(); diff --git a/mbbsd/read.c b/mbbsd/read.c index 7fcc9f1e..40561cb8 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -419,19 +419,17 @@ mail_forward(fileheader_t * fhdr, char *direct, int mode) *p = '\0'; switch (i = doforward(buf, fhdr, mode)) { case 0: - outmsg(msg_fwd_ok); + vmsg(msg_fwd_ok); break; case -1: - outmsg(msg_fwd_err1); + vmsg(msg_fwd_err1); break; case -2: - outmsg(msg_fwd_err2); + vmsg(msg_fwd_err2); break; default: break; } - refresh(); - sleep(1); } #endif @@ -811,7 +809,7 @@ void i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey_t * rcmdlist, int bidcache) { keeploc_t *locmem = NULL; - int recbase = 0, mode; + int recbase = 0, mode, lastmode; int num = 0, entries = 0, n_bottom=0; int i; char currdirect0[64], default_ch = 0; @@ -903,6 +901,8 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey mode = i_read_key(rcmdlist, default_ch, locmem, currbid, bottom_line); + if(mode == READ_SKIP) + mode = lastmode; switch(mode) // 以下這幾種 mode 要再處理游標 { case READ_PREV: @@ -936,6 +936,7 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey default: default_ch=0; } + lastmode = mode; } while (mode != DOQUIT); #undef FHSZ diff --git a/mbbsd/register.c b/mbbsd/register.c index 9e6c60b3..71d653a2 100644 --- a/mbbsd/register.c +++ b/mbbsd/register.c @@ -175,9 +175,7 @@ getnewuserid() i = searchnewuser(1); if ((i <= 0) || (i > MAX_USERS)) { passwd_unlock(); - if (more("etc/user_full", NA) == -1) - fprintf(stdout, "抱歉,使用者帳號已經滿了,無法註冊新的帳號\n\r"); - safe_sleep(2); + vmsg("抱歉,使用者帳號已經滿了,無法註冊新的帳號"); exit(1); } snprintf(genbuf, sizeof(genbuf), "uid %d", i); @@ -203,10 +201,7 @@ new_register() if( passbuf[0] == 'y' ) break; if( passbuf[0] == 'n' ){ - clear(); - outs("\n抱歉, 您須要接受使用者條款才能註冊帳號享受我們的服務唷!"); - pressanykey(); - oflush(); + vmsg("\n抱歉, 您須要接受使用者條款才能註冊帳號享受我們的服務唷!"); exit(1); } vmsg("請輸入 y表示接受, n表示不接受"); @@ -217,11 +212,7 @@ new_register() try = 0; while (1) { if (++try >= 6) { - outs("\n您嘗試錯誤的輸入太多,請下次再來吧\n"); - refresh(); - - pressanykey(); - oflush(); + vmsg("\n您嘗試錯誤的輸入太多,請下次再來吧\n"); exit(1); } getdata(17, 0, msg_uid, newuser.userid, @@ -243,11 +234,7 @@ new_register() try = 0; while (1) { if (++try >= 6) { - outs("\n您嘗試錯誤的輸入太多,請下次再來吧\n"); - refresh(); - - pressanykey(); - oflush(); + vmsg("\n您嘗試錯誤的輸入太多,請下次再來吧\n"); exit(1); } if ((getdata(19, 0, "請設定密碼:", passbuf, diff --git a/mbbsd/screen.c b/mbbsd/screen.c index 43df3757..dcfafe2e 100644 --- a/mbbsd/screen.c +++ b/mbbsd/screen.c @@ -445,7 +445,7 @@ prints(char *fmt,...) } void -mprints(int y, int x, char *str) +mouts(int y, int x, char *str) { move(y, x); clrtoeol(); diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 92053e60..d7550ba3 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -592,9 +592,7 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) strlcpy(destid, id, sizeof(destid)); if (!uin && !(flag == 0 && water_which->count > 0)) { - outmsg("\033[1;33;41m糟糕! 對方已落跑了(不在站上)! \033[37m~>_<~\033[m"); - clrtoeol(); - refresh(); + vmsg("糟糕! 對方已落跑了(不在站上)! "); watermode = -1; return 0; } @@ -608,9 +606,6 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) /* 一般水球 */ watermode = 0; if (!(len = getdata(0, 0, prompt, msg, 56, DOECHO))) { - outmsg("\033[1;33;42m算了! 放你一馬...\033[m"); - clrtoeol(); - refresh(); currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; @@ -635,9 +630,6 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) snprintf(buf, sizeof(buf), "丟給 %s : %s [Y/n]?", uin->userid, msg); getdata(0, 0, buf, genbuf, 3, LCECHO); if (genbuf[0] == 'n') { - outmsg("\033[1;33;42m算了! 放你一馬...\033[m"); - clrtoeol(); - refresh(); currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; @@ -647,9 +639,7 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) } watermode = -1; if (!uin || !*uin->userid || strcasecmp(destid, uin->userid)) { - outmsg("\033[1;33;41m糟糕! 對方已落跑了(不在站上)! \033[37m~>_<~\033[m"); - clrtoeol(); - refresh(); + vmsg("糟糕! 對方已落跑了(不在站上)! "); currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; @@ -712,7 +702,6 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) } clrtoeol(); - refresh(); currutmp->chatid[0] = c0; currutmp->mode = mode0; @@ -1853,7 +1842,7 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way, #endif ); - refresh(); + //refresh(); } } @@ -2397,12 +2386,9 @@ userlist(void) cuser.uflag2 -= tmp; tmp = (tmp + 1) % 3; cuser.uflag2 |= tmp; - move(4, 0); - prints("系統提供 一般 進階 未來 三種模式\n" + vmsg("系統提供 一般 進階 未來 三種模式\n" "在切換後請正常下線再重新登入, 以確保結構正確\n" "目前切換到 %s 水球模式\n", wm[tmp]); - refresh(); - sleep(2); redrawall = redraw = 1; } break; diff --git a/mbbsd/vote.c b/mbbsd/vote.c index a6cb52c4..5325e64c 100644 --- a/mbbsd/vote.c +++ b/mbbsd/vote.c @@ -535,7 +535,7 @@ vote_view_all(char *bname) setbfile(buf, bname, STR_new_control); move(0, 0); if ((fp = fopen(buf, "r"))) { - prints("(0) "); + outs("(0) "); x = 0; fclose(fp); @@ -760,7 +760,6 @@ vote_maintain(char *bname) move((i % 15) + 2, (i / 15) * 40); prints(buf); } - refresh(); } snprintf(buf, sizeof(buf), "%c) ", num + 'A'); getdata((num % 15) + 2, (num / 15) * 40, buf, diff --git a/mbbsd/xyz.c b/mbbsd/xyz.c index e0b850b5..b20b9d74 100644 --- a/mbbsd/xyz.c +++ b/mbbsd/xyz.c @@ -180,9 +180,7 @@ note() notedata_t myitem; if (cuser.money < 5) { - outmsg("\033[1;41m 哎呀! 要投五銀才能留言...沒錢耶..\033[m"); - clrtoeol(); - refresh(); + vmsg("\033[1;41m 哎呀! 要投五銀才能留言...沒錢耶..\033[m"); return 0; } setutmpmode(EDNOTE); @@ -313,7 +311,7 @@ mail_sysop() move(12, 0); clrtobot(); - prints("%16s %-18s權責劃分\n\n", "編號", "站長 ID"); + outs(" 編號 站長 ID 權責劃分\n\n"); for (i = 0; i < j; i++) prints("%15d. \033[1;%dm%-16s%s\033[0m\n", |