diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-06 04:19:49 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-06 04:19:49 +0800 |
commit | ff24026ce0222c9b0bc78ee075dd0ca9bb50c193 (patch) | |
tree | 70f8bffef1edbe949b5aaf83c5dd8717fdb9e87b /mbbsd | |
parent | 7fe0f796e47c21a8975c956830f0b63f024e35d2 (diff) | |
download | pttbbs-ff24026ce0222c9b0bc78ee075dd0ca9bb50c193.tar pttbbs-ff24026ce0222c9b0bc78ee075dd0ca9bb50c193.tar.gz pttbbs-ff24026ce0222c9b0bc78ee075dd0ca9bb50c193.tar.bz2 pttbbs-ff24026ce0222c9b0bc78ee075dd0ca9bb50c193.tar.lz pttbbs-ff24026ce0222c9b0bc78ee075dd0ca9bb50c193.tar.xz pttbbs-ff24026ce0222c9b0bc78ee075dd0ca9bb50c193.tar.zst pttbbs-ff24026ce0222c9b0bc78ee075dd0ca9bb50c193.zip |
large terminal rules.
- vmsg with formats is now vmsgf.
- deprecates vmsg_lines
= i hope changes in admin does not make trouble
because the old way looks like a mess within my terminal.
- pending issue:
= pressanykey_or_callangel is in oldway
= showtitle, msg_seperator, and others should also be fixed
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2995 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/admin.c | 21 | ||||
-rw-r--r-- | mbbsd/announce.c | 6 | ||||
-rw-r--r-- | mbbsd/bbs.c | 46 | ||||
-rw-r--r-- | mbbsd/brc.c | 2 | ||||
-rw-r--r-- | mbbsd/cal.c | 2 | ||||
-rw-r--r-- | mbbsd/card.c | 16 | ||||
-rw-r--r-- | mbbsd/chicken.c | 2 | ||||
-rw-r--r-- | mbbsd/edit.c | 2 | ||||
-rw-r--r-- | mbbsd/io.c | 2 | ||||
-rw-r--r-- | mbbsd/mail.c | 6 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 11 | ||||
-rw-r--r-- | mbbsd/stuff.c | 118 | ||||
-rw-r--r-- | mbbsd/talk.c | 4 |
13 files changed, 155 insertions, 83 deletions
diff --git a/mbbsd/admin.c b/mbbsd/admin.c index 1cb37787..cb79582c 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -779,7 +779,7 @@ x_file(void) return FULLUPDATE; } aborted = vedit(fpath, NA, NULL); - vmsg("\n\n系統檔案[%s]:%s", fpath, + vmsgf("\n\n系統檔案[%s]:%s", fpath, (aborted == -1) ? "未改變" : "更新完畢"); return FULLUPDATE; } @@ -1092,7 +1092,7 @@ scan_register_form(const char *regfile, int automode, int neednum) } Rename(regfile, fname); if ((fn = fopen(fname, "r")) == NULL) { - vmsg("系統錯誤,無法讀取註冊資料檔: %s", fname); + vmsgf("系統錯誤,無法讀取註冊資料檔: %s", fname); return -1; } if (neednum) { /* 被強迫審的 */ @@ -1136,6 +1136,7 @@ scan_register_form(const char *regfile, int automode, int neednum) uid = cuser.userid; move(1, 0); + clrtobot(); prints("帳號位置 :%d\n", unum); user_display(&muser, 1); move(14, 0); @@ -1159,8 +1160,9 @@ scan_register_form(const char *regfile, int automode, int neednum) ans[0] = 'd'; } else { if (search_ulist(unum) == NULL) - ans[0] = vmsg_lines(22, - "是否接受此資料(Y/N/Q/Del/Skip)?[S])"); + { + ans[0] = getkey("是否接受此資料(Y/N/Q/Del/Skip)?[S])"); + } else ans[0] = 's'; if ('A' <= ans[0] && ans[0] <= 'Z') @@ -1196,16 +1198,19 @@ scan_register_form(const char *regfile, int automode, int neednum) /* please confirm match REJECT_REASONS here */ case 'n': if (ans[0] == 'n') { - for (n = 0; field[n]; n++) - prints("%s: %s\n", finfo[n], fdata[n]); - move(9, 0); + int nf = 0; + move(8, 0); + clrtobot(); outs("請提出退回申請表原因,按 <enter> 取消\n"); for (n = 0; reason[n]; n++) prints("%d) 請%s\n", n, reason[n]); + outs("\n"); // preserved for prompt + for (nf = 0; field[nf]; nf++) + prints("%s: %s\n", finfo[nf], fdata[nf]); } else buf[0] = ans[0]; if (ans[0] != 'n' || - getdata(10 + n, 0, "退回原因:", buf, 60, DOECHO)) + getdata(9 + n, 0, "退回原因:", buf, 60, DOECHO)) if ((buf[0] - '0') >= 0 && (buf[0] - '0') < n) { int i; fileheader_t mhdr; diff --git a/mbbsd/announce.c b/mbbsd/announce.c index 78cfbfc8..b9197343 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -883,7 +883,7 @@ a_showname(const menu_t * pm) sym = 1; } if (sym) { - vmsg("此 symbolic link 指向 %s\n", &buf[i + 1]); + vmsgf("此 symbolic link 指向 %s\n", &buf[i + 1]); } } } @@ -1075,12 +1075,12 @@ a_menu(const char *maintitle, char *path, int lastlevel, char *trans_buffer) if (!isvisible_man(&me)) break; #ifdef DEBUG - vmsg("%s/%s", &path[11], fhdr->filename);; + vmsgf("%s/%s", &path[11], fhdr->filename);; #endif snprintf(fname, sizeof(fname), "%s/%s", path, fhdr->filename); if (*fhdr->filename == 'H' && fhdr->filename[1] == '.') { vmsg("不再支援 gopher mode, 請使用瀏覽器直接瀏覽"); - vmsg("gopher://%s/1/",fhdr->filename+2); + vmsgf("gopher://%s/1/",fhdr->filename+2); } else if (dashf(fname)) { int more_result; diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 03afeb50..37e8eb8f 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -255,7 +255,7 @@ readtitle(void) showtitle(currBM, brd_title); outs("[←]離開 [→]閱\讀 [^P]發表文章 [b]備忘錄 [d]刪除 [z]精華區 [TAB]文摘 [h]說明\n"); - prints(ANSI_COLOR(7) " 編號 %s 作 者 文 章 標 題", + prints(ANSI_COLOR(7) " 編號 %s 作 者 文 章 標 題", listmode_desc[currlistmode]); #ifdef USE_COOLDOWN @@ -299,9 +299,23 @@ readdoent(int num, fileheader_t * ent) else color = '3', mark = "R:"; - /* 把多餘的 string 砍掉 */ - if (title[45]) - strlcpy(title + PROPER_TITLE_LEN, " …", sizeof(title) - PROPER_TITLE_LEN); + /* 把過長的 title 砍掉。 前面約有 33 個字元。 */ + { + int l = t_columns - 34; /* 33+1, for trailing one more space */ + unsigned char *p = (unsigned char*)title; + + /* strlen 順便做 safe print checking */ + while (*p && l > 0) + { + /* 本來應該做 DBCS checking, 懶得寫了 */ + if(*p < ' ') + *p = ' '; + p++, l--; + } + + if (*p && l <= 0) + strcpy(p-3, " …"); + } if (!strncmp(title, "[公告]", 6)) special = 1; @@ -327,10 +341,14 @@ readdoent(int num, fileheader_t * ent) sprintf(recom,"0mX%d",-ent->recommend); else strcpy(recom,"0m "); + /* start printing */ if (ent->filemode & FILE_BOTTOM) - outs(" " ANSI_COLOR(1;33) " ★ " ANSI_RESET); + outs(" " ANSI_COLOR(1;33) " ★ " ANSI_RESET); else - prints("%6d", num); + /* recently we found that many boards have >10k articles, + * so it's better to use 5+2 (2 for cursor marker) here. + */ + prints("%7d", num); prints(" %c\033[1;3%4.4s" ANSI_RESET, type, recom); @@ -1940,7 +1958,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) int d = (int)bp->fastrecommend_pause - (now - lastrecommend); if (d > 0) { - vmsg("本板禁止快速連續推文,請再等 %d 秒", d); + vmsgf("本板禁止快速連續推文,請再等 %d 秒", d); return FULLUPDATE; } } @@ -2264,7 +2282,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct) cuser.numposts--; if (!(currmode & MODE_DIGEST && currmode & MODE_BOARD)){ demoney(-fhdr->multi.money); - vmsg("您的文章減為 %d 篇,支付清潔費 %d 銀", + vmsgf("您的文章減為 %d 篇,支付清潔費 %d 銀", cuser.numposts, fhdr->multi.money); } } @@ -2279,7 +2297,7 @@ show_filename(int ent, const fileheader_t * fhdr, const char *direct) { if(!HasUserPerm(PERM_SYSOP)) return DONOTHING; - vmsg("檔案名稱: %s ", fhdr->filename); + vmsgf("檔案名稱: %s ", fhdr->filename); return PART_REDRAW; } @@ -2296,7 +2314,7 @@ view_postmoney(int ent, const fileheader_t * fhdr, const char *direct) else if(fhdr->filemode & FILE_ANONYMOUS) /* When the file is anonymous posted, fhdr->multi.anon_uid is author. * see do_general() */ - vmsg("匿名管理編號: %d (同一人號碼會一樣)", + vmsgf("匿名管理編號: %d (同一人號碼會一樣)", fhdr->multi.anon_uid + (int)currutmp->pid); else if(currmode & MODE_SELECT && (fhdr->multi.refer.flag) && (num = fhdr->multi.refer.ref)) @@ -2308,7 +2326,7 @@ view_postmoney(int ent, const fileheader_t * fhdr, const char *direct) else money = fhdr->multi.money; - if (vmsg("這一篇文章值 %d 銀", fhdr->multi.money) == 'Q') + if (vmsgf("這一篇文章值 %d 銀", fhdr->multi.money) == 'Q') { /* QQ: enable money listing mode */ currlistmode = (currlistmode == LISTMODE_MONEY) ? @@ -2939,12 +2957,12 @@ int check_cooldown(boardheader_t *bp) { if( bp->brdattr & BRD_COOLDOWN ) { - vmsg("冷靜一下吧! (限制 %d 分 %d 秒)", diff/60, diff%60); + vmsgf("冷靜一下吧! (限制 %d 分 %d 秒)", diff/60, diff%60); return 1; } else if(posttimesof(usernum)==15) { - vmsg("對不起,您被設劣文! (限制 %d 分 %d 秒)", diff/60, diff%60); + vmsgf("對不起,您被設劣文! (限制 %d 分 %d 秒)", diff/60, diff%60); return 1; } #ifdef NO_WATER_POST @@ -2953,7 +2971,7 @@ int check_cooldown(boardheader_t *bp) for(i=0; i<4; i++) if(bp->nuser>limit[i*2] && posttimesof(usernum)>=limit[i*2+1]) { - vmsg("對不起,您的文章太水囉!用'X'推薦文章 (限制 %d 分 %d 秒)", + vmsgf("對不起,您的文章太水囉!用'X'推薦文章 (限制 %d 分 %d 秒)", diff/60, diff%60); return 1; } diff --git a/mbbsd/brc.c b/mbbsd/brc.c index 0ffbc9bc..68f4fdeb 100644 --- a/mbbsd/brc.c +++ b/mbbsd/brc.c @@ -160,7 +160,7 @@ brc_enlarge_buf(void) memcpy(brc_buf, buffer, brc_alloc - BRC_BLOCKSIZE); #ifdef DEBUG - vmsg("brc enlarged to %d bytes", brc_alloc); + vmsgf("brc enlarged to %d bytes", brc_alloc); #endif THE_FREE(buffer); diff --git a/mbbsd/cal.c b/mbbsd/cal.c index 013746d5..049db86b 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -331,7 +331,7 @@ p_exmail(void) int n; if (cuser.exmailbox >= MAX_EXKEEPMAIL) { - vmsg("容量最多增加 %d 封,不能再買了。", MAX_EXKEEPMAIL); + vmsgf("容量最多增加 %d 封,不能再買了。", MAX_EXKEEPMAIL); return 0; } snprintf(buf, sizeof(buf), diff --git a/mbbsd/card.c b/mbbsd/card.c index 14b3cdf8..ab9ce89a 100644 --- a/mbbsd/card.c +++ b/mbbsd/card.c @@ -474,11 +474,11 @@ card_jack(int *db) c[0]=1; card_show(6, cpu, c, me, m); game_log(JACK, JACK); - vmsg("你跟電腦都拿到黑傑克, 退還 %d 元", JACK); + vmsgf("你跟電腦都拿到黑傑克, 退還 %d 元", JACK); return 0; } game_log(JACK, JACK * 5/2); - vmsg("很不錯唷! (黑傑克!! 加 %d 元)", JACK * 5/2); + vmsgf("很不錯唷! (黑傑克!! 加 %d 元)", JACK * 5/2); return 0; } else if(card_isblackjack(cpu[0],cpu[1])) { c[0] = 1; @@ -510,7 +510,7 @@ card_jack(int *db) } if (i == 6) { /* 畫面只能擺六張牌, 因此直接算玩家贏. 黑傑克實際上沒這規則 */ game_log(JACK, JACK * 10); - vmsg("好厲害唷! 六張牌還沒爆! 加P幣 %d 元!", 5 * JACK); + vmsgf("好厲害唷! 六張牌還沒爆! 加P幣 %d 元!", 5 * JACK); return 0; } @@ -522,7 +522,7 @@ card_jack(int *db) if (card_alls_lower(cpu) > 21) { card_show(6, cpu, c, me, m); game_log(JACK, JACK * 2); - vmsg("呵呵...電腦爆掉了! 你贏了! 可得P幣 %d 元", JACK * 2); + vmsgf("呵呵...電腦爆掉了! 你贏了! 可得P幣 %d 元", JACK * 2); return 0; } j++; @@ -530,12 +530,12 @@ card_jack(int *db) card_show(6, cpu, c, me, m); if(card_alls_upper(cpu)==card_alls_upper(me)) { game_log(JACK, JACK); - vmsg("平局,退回P幣 %d 元!", JACK); + vmsgf("平局,退回P幣 %d 元!", JACK); return 0; } if(card_alls_upper(cpu)<card_alls_upper(me)) { game_log(JACK, JACK * 2); - vmsg("呵呵...電腦比較小! 你贏了! 可得P幣 %d 元", JACK * 2); + vmsgf("呵呵...電腦比較小! 你贏了! 可得P幣 %d 元", JACK * 2); return 0; } game_log(JACK, 0); @@ -614,7 +614,7 @@ ten_helf(void) } if (i == 5) { /* 過五關 */ game_log(TEN_HALF, PMONEY * 5); - vmsg("好厲害唷! 過五關嘍! 加P幣 %d 元!", 5 * PMONEY); + vmsgf("好厲害唷! 過五關嘍! 加P幣 %d 元!", 5 * PMONEY); return 0; } j = 1; @@ -626,7 +626,7 @@ ten_helf(void) if (card_all(cpu) > 21) { card_show(5, cpu, c, me, m); game_log(TEN_HALF, PMONEY * 2); - vmsg("呵呵...電腦爆掉了! 你贏了! 可得P幣 %d 元", PMONEY * 2); + vmsgf("呵呵...電腦爆掉了! 你贏了! 可得P幣 %d 元", PMONEY * 2); return 0; } j++; diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c index 9cf684d1..0a8b7db9 100644 --- a/mbbsd/chicken.c +++ b/mbbsd/chicken.c @@ -124,7 +124,7 @@ new_chicken(void) reload_money(); price = egg_price[(int)mychicken->type]; if (cuser.money < price) { - vmsg("錢不夠買蛋蛋,蛋蛋要 %d 元", price); + vmsgf("錢不夠買蛋蛋,蛋蛋要 %d 元", price); return 0; } vice(price, "寵物蛋"); diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 8b6932e1..05159707 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -252,7 +252,7 @@ int fix_cursor(char *str, int pos, unsigned int dir) static void indigestion(int i) { - vmsg("嚴重內傷 (%d)\n", i); + vmsgf("嚴重內傷 (%d)\n", i); u_exit("EDITOR FAILED"); exit(0); } @@ -412,7 +412,7 @@ igetch(void) case Ctrl('Q'):{ struct rusage ru; getrusage(RUSAGE_SELF, &ru); - vmsg("sbrk: %d KB, idrss: %d KB, isrss: %d KB", + vmsgf("sbrk: %d KB, idrss: %d KB, isrss: %d KB", ((int)sbrk(0) - 0x8048000) / 1024, (int)ru.ru_idrss, (int)ru.ru_isrss); } diff --git a/mbbsd/mail.c b/mbbsd/mail.c index aa553b42..5e0bf175 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -247,13 +247,13 @@ chkmailbox(void) case MAILBOX_LIM_KEEP: bell(); bell(); - vmsg("您保存信件數目 %d 超出上限 %d, 請整理", mailkeep, mailmaxkeep); + vmsgf("您保存信件數目 %d 超出上限 %d, 請整理", mailkeep, mailmaxkeep); return mailkeep; case MAILBOX_LIM_SUM: bell(); bell(); - vmsg("信箱容量(大小,非件數) %d 超出上限 %d, " + vmsgf("信箱容量(大小,非件數) %d 超出上限 %d, " "請砍過長的水球記錄或信件", mailsum, mailsumlimit); if(showmail_mode != SHOWMAIL_SUM) { @@ -715,7 +715,7 @@ mail_all(void) sethomedir(genbuf, userid); if (append_record_forward(genbuf, &mymail, sizeof(mymail), userid) == -1) outs(err_uid); - vmsg("%*s %5d / %5d", IDLEN + 1, userid, i + 1, unum); + vmsgf("%*s %5d / %5d", IDLEN + 1, userid, i + 1, unum); } } return 0; diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 38fadf81..8369f50d 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -831,9 +831,14 @@ setup_utmp(int mode) inline static void welcome_msg(void) { - prints(ANSI_RESET " 歡迎您第 " ANSI_COLOR(1;33) "%d" ANSI_COLOR(0;37) " 度拜訪本站," - "上次您是從 " ANSI_COLOR(1;33) "%s" ANSI_COLOR(0;37) " 連往本站,\n" - " 我記得那天是 " ANSI_COLOR(1;33) "%s" ANSI_COLOR(0;37) "。\n", + prints(ANSI_RESET " 歡迎您第 " + ANSI_COLOR(1;33) "%d" ANSI_COLOR(0;37) " 度拜訪本站,上次您是從 " + ANSI_COLOR(1;33) "%s" ANSI_COLOR(0;37) " 連往本站," + ANSI_CLRTOEND "\n" + " 我記得那天是 " ANSI_COLOR(1;33) "%s" ANSI_COLOR(0;37) "。" + ANSI_CLRTOEND "\n" + ANSI_CLRTOEND "\n" + , ++cuser.numlogins, cuser.lasthost, Cdate(&(cuser.lastlogin))); pressanykey(); } diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index 090b3704..3789f2a8 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -545,38 +545,17 @@ capture_screen(void) } } -int -vmsg_lines(const int lines, const char msg[]) -{ - int ch; - - move(lines, 0); - clrtoeol(); - - if (msg) - outs((char *)msg); - else - outs(ANSI_COLOR(1;34;44) " ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄" ANSI_COLOR(1;37;44) " 請按 " -ANSI_COLOR(36) "任意鍵 " ANSI_COLOR(37) "繼續 " ANSI_COLOR(1;34) "▄▄▄▄▄" ANSI_COLOR(36) "^T 收錄暫存檔" ANSI_COLOR(34) "▄▄▄ " ANSI_RESET); - - do { - if( (ch = igetch()) == Ctrl('T') ) - capture_screen(); - } while( ch == 0 ); - - move(lines, 0); - clrtoeol(); - return ch; -} - #ifdef PLAY_ANGEL void pressanykey_or_callangel(){ int ch; outmsg( -ANSI_COLOR(1;34;44) " ▄▄▄▄ " ANSI_COLOR(32) "H " ANSI_COLOR(36) "呼叫小天使" ANSI_COLOR(34) " ▄▄▄▄" ANSI_COLOR(1;37;44) " 請按 " -ANSI_COLOR(36) "任意鍵 " ANSI_COLOR(37) "繼續 " ANSI_COLOR(1;34) "▄▄▄▄▄" ANSI_COLOR(36) "^T 收錄暫存檔" ANSI_COLOR(34) "▄▄▄ " ANSI_RESET); + ANSI_COLOR(1;34;44) " ▄▄▄▄ " + ANSI_COLOR(32) "H " ANSI_COLOR(36) "呼叫小天使" ANSI_COLOR(34) + " ▄▄▄▄" ANSI_COLOR(37;44) " 請按 " ANSI_COLOR(36) "任意鍵 " + ANSI_COLOR(37) "繼續 " ANSI_COLOR(1;34) + "▄▄▄▄▄" ANSI_COLOR(36) "^T 收錄暫存檔" ANSI_COLOR(34) "▄▄▄ " ANSI_RESET); do { ch = igetch(); @@ -620,24 +599,89 @@ getkey(const char *fmt,...) va_start(ap, fmt); i = vsnprintf(msg , 128, fmt, ap); va_end(ap); - return vmsg_lines(b_lines, msg); + return vmsg(msg); } -/* TODO 極少 caller 用到 format, 考慮拆開成 vmsgf 節省 cpu */ +static const char *msg_pressanykey_full = + ANSI_COLOR(37;44) " 請按" ANSI_COLOR(36) " 任意鍵 " ANSI_COLOR(37) "繼續 " ANSI_COLOR(34); +#define msg_pressanykey_full_len (18) + +static const char *msg_pressanykey_full_trail = + ANSI_COLOR(36) + " [^T 收錄暫存檔] " ANSI_RESET; +#define msg_pressanykey_full_trail_len (18) /* 4 for head */ + +static const char* msg_pressanykey_trail = + ANSI_COLOR(33;46) " " ANSI_COLOR(200) ANSI_COLOR(1431) ANSI_COLOR(506) + "[按任意鍵繼續]" ANSI_COLOR(201) " " ANSI_RESET; +#define msg_pressanykey_trail_len (16+1+4) /* 4 for head */ + int -vmsg(const char *fmt,...) +vmsg(const char *msg) { - char msg[256] = ANSI_COLOR(1;36;44) " ◆ "; - int i=14; // 14=strlen(msg) + int len = msg ? strlen(msg) : 0; + int i = 0; + + if(len == 0) msg = NULL; + + move(b_lines, 0); + clrtoeol(); + + if(!msg) + { + /* msg_pressanykey_full */ + int w = (t_columns - msg_pressanykey_full_len - 8) / 2; + int pad = 0; + + outs(ANSI_COLOR(1;34;44) " "); + pad += 1; + for (i = 0; i < w; i += 2) + outs("▄"), pad+=2; + outs(msg_pressanykey_full), pad+= msg_pressanykey_full_len; + /* pad now points to position of current cursor. */ + pad = t_columns - msg_pressanykey_full_trail_len - pad; + /* pad is now those left . */ + if (pad > 0) + { + for (i = 0; i <= pad-2; i += 2) + outs("▄"); + if (i == pad-1) + outc(' '); + } + outs(msg_pressanykey_full_trail); + } else { + /* msg_pressanykey_trail */ + outs(ANSI_COLOR(1;36;44) " ◆ "); + if(len >= t_columns - msg_pressanykey_trail_len) + len = t_columns - msg_pressanykey_trail_len; + while (i++ < len) + outc(*msg++); + i--; + while (i++ < t_columns - msg_pressanykey_trail_len) + outc(' '); + outs(msg_pressanykey_trail); + } + + do { + if( (i = igetch()) == Ctrl('T') ) + capture_screen(); + } while( i == 0 ); + + move(b_lines, 0); + clrtoeol(); + return i; +} + +int +vmsgf(const char *fmt,...) +{ + char msg[256]; va_list ap; va_start(ap, fmt); - i += vsnprintf(msg + i, 128, fmt, ap); + vsnprintf(msg, sizeof(msg)-1, fmt, ap); va_end(ap); - for(; i < 71; i++) - msg[i] = ' '; - strcat(msg + 71, - ANSI_COLOR(33;46) " " ANSI_COLOR(200) ANSI_COLOR(1431) ANSI_COLOR(506) "[按任意鍵繼續]" ANSI_COLOR(201) " " ANSI_RESET); - return vmsg_lines(b_lines, msg); + msg[sizeof(msg)-1] = 0; + return vmsg(msg); } /** diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 7b0e2e14..9bcac216 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -2644,7 +2644,7 @@ userlist(void) ctime4(&currutmp->lastact)); mail_redenvelop(cuser.userid, uentp->userid, ch - give_tax(ch), 'Y'); - vmsg(" 嗯..還剩下 %d 錢..", demoney(-ch)); + vmsgf(" 嗯..還剩下 %d 錢..", demoney(-ch)); } } else { clrtoeol(); @@ -2713,7 +2713,7 @@ userlist(void) move(b_lines - 3, 0); prints("系統提供 一般 進階 未來 三種模式\n" "在切換後請正常下線再重新登入, 以確保結構正確\n"); - vmsg( "目前切換到 %s 水球模式", wm[tmp]); + vmsgf( "目前切換到 %s 水球模式", wm[tmp]); redrawall = redraw = 1; } break; |