summaryrefslogtreecommitdiffstats
path: root/mbbsd/mbbsd.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-08 10:46:24 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-08 10:46:24 +0800
commita0f8ef1e2e04905908478088fc376435b770417c (patch)
treea96bd4096703e5d0bb0b9fe7c9499d0db7768070 /mbbsd/mbbsd.c
parentf55eaef82ab265772418a545f32fa2780468603b (diff)
downloadpttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.gz
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.bz2
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.lz
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.xz
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.zst
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.zip
New style to specify ANSI escape commands.
First introduced by pmore, but this hard work (to transform all files to new style) is made by Rong-en Fan (rafan). Thanks! git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2796 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mbbsd.c')
-rw-r--r--mbbsd/mbbsd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index c99468c5..4b915a36 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -219,7 +219,7 @@ abort_bbs_debug(int sig)
case SIGBUS: STATINC(STAT_SIGBUS); break;
case SIGSEGV: STATINC(STAT_SIGSEGV); break;
}
-#define CRASH_MSG "\033[0m\r\n程式異常, 立刻斷線. 請洽 PttBug 板詳述你發生的問題.\n"
+#define CRASH_MSG ANSI_COLOR(0) "\r\n程式異常, 立刻斷線. 請洽 PttBug 板詳述你發生的問題.\n"
/* NOTE: It's better to use signal-safe functions. Avoid to call
* functions with global/static variable -- data may be corrupted */
write(1, CRASH_MSG, sizeof(CRASH_MSG));
@@ -260,7 +260,7 @@ talk_request(int sig)
move(0, 0);
clrtoeol();
- prints("\033[33;41m★%s\033[34;47m [%s] %s \033[0m",
+ prints(ANSI_COLOR(33;41) "★%s" ANSI_COLOR(34;47) " [%s] %s " ANSI_COLOR(0) "",
SHM->uinfo[currutmp->destuip].userid, my_ctime(&now,timebuf,sizeof(timebuf)),
(currutmp->sig == 2) ? "重要消息廣播!(請Ctrl-U,l查看熱訊記錄)"
: "呼叫、呼叫,聽到請回答");
@@ -289,11 +289,11 @@ show_call_in(int save, int which)
char buf[200];
#ifdef PLAY_ANGEL
if (currutmp->msgs[which].msgmode == MSGMODE_TOANGEL)
- snprintf(buf, sizeof(buf), "\033[1;37;46m★%s\033[37;45m %s \033[m",
+ snprintf(buf, sizeof(buf), ANSI_COLOR(1;37;46) "★%s" ANSI_COLOR(37;45) " %s " ANSI_RESET,
currutmp->msgs[which].userid, currutmp->msgs[which].last_call_in);
else
#endif
- snprintf(buf, sizeof(buf), "\033[1;33;46m★%s\033[37;45m %s \033[m",
+ snprintf(buf, sizeof(buf), ANSI_COLOR(1;33;46) "★%s" ANSI_COLOR(37;45) " %s " ANSI_RESET,
currutmp->msgs[which].userid, currutmp->msgs[which].last_call_in);
outmsg(buf);
@@ -831,9 +831,9 @@ setup_utmp(int mode)
inline static void welcome_msg(void)
{
- prints("\033[m 歡迎您第 \033[1;33m%d\033[0;37m 度拜訪本站,"
- "上次您是從 \033[1;33m%s\033[0;37m 連往本站,\n"
- " 我記得那天是 \033[1;33m%s\033[0;37m。\n",
+ 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",
++cuser.numlogins, cuser.lasthost, Cdate(&(cuser.lastlogin)));
pressanykey();
}