diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-09-10 17:00:29 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-09-10 17:00:29 +0800 |
commit | a3fa704d1272a56465922cad9d52eb5cabc8ac05 (patch) | |
tree | e9f6741be32e4d2559051e9ad2c381278bb0a810 /mbbsd/menu.c | |
parent | cf8c6166f982e9124e00403254f8152b3790f755 (diff) | |
download | pttbbs-a3fa704d1272a56465922cad9d52eb5cabc8ac05.tar pttbbs-a3fa704d1272a56465922cad9d52eb5cabc8ac05.tar.gz pttbbs-a3fa704d1272a56465922cad9d52eb5cabc8ac05.tar.bz2 pttbbs-a3fa704d1272a56465922cad9d52eb5cabc8ac05.tar.lz pttbbs-a3fa704d1272a56465922cad9d52eb5cabc8ac05.tar.xz pttbbs-a3fa704d1272a56465922cad9d52eb5cabc8ac05.tar.zst pttbbs-a3fa704d1272a56465922cad9d52eb5cabc8ac05.zip |
code clean up
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1174 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/menu.c')
-rw-r--r-- | mbbsd/menu.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/mbbsd/menu.c b/mbbsd/menu.c index bca66e7b..1e42410c 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -92,7 +92,27 @@ showtitle(char *title, char *mid) #define FILMROW 11 static unsigned char menu_row = 12; static unsigned char menu_column = 20; -static char mystatus[160]; + +static void +show_status(void) +{ + int i; + struct tm *ptime = localtime(&now); + char mystatus[160]; + char *myweek = "天一二三四五六"; + const char *msgs[] = {"關閉", "打開", "拔掉", "防水", "好友"}; + + i = ptime->tm_wday << 1; + snprintf(mystatus, sizeof(mystatus), + "\033[34;46m[%d/%d 星期%c%c %d:%02d]\033[1;33;45m%-14s" + "\033[30;47m 目前坊裡有 \033[31m%d\033[30m人, 我是\033[31m%-12s" + "\033[30m[扣機]\033[31m%s\033[0m", + ptime->tm_mon + 1, ptime->tm_mday, myweek[i], myweek[i + 1], + ptime->tm_hour, ptime->tm_min, currutmp->birth ? + "生日要請客唷" : SHM->today_is, + SHM->UTMPnumber, cuser.userid, msgs[currutmp->pager]); + outmsg(mystatus); +} static int u_movie() @@ -105,9 +125,6 @@ void movie(int i) { static short history[MAX_HISTORY]; - char *myweek = "天一二三四五六"; - const char *msgs[] = {"關閉", "打開", "拔掉", "防水", "好友"}; - struct tm *ptime = localtime(&now); int j; if ((currstat != CLASS) && (cuser.uflag & MOVIE_FLAG) && @@ -140,16 +157,7 @@ movie(int i) Jaky_outs(SHM->notes[i], 11); /* 只印11行就好 */ outs(reset_color); } - i = ptime->tm_wday << 1; - snprintf(mystatus, sizeof(mystatus), - "\033[34;46m[%d/%d 星期%c%c %d:%02d]\033[1;33;45m%-14s" - "\033[30;47m 目前坊裡有 \033[31m%d\033[30m人, 我是\033[31m%-12s" - "\033[30m[扣機]\033[31m%s\033[0m", - ptime->tm_mon + 1, ptime->tm_mday, myweek[i], myweek[i + 1], - ptime->tm_hour, ptime->tm_min, currutmp->birth ? - "生日要請客唷" : SHM->today_is, - SHM->UTMPnumber, cuser.userid, msgs[currutmp->pager]); - outmsg(mystatus); + show_status(); refresh(); } @@ -193,7 +201,7 @@ domenu(int cmdmode, char *cmdtitle, int cmd, commands_t cmdtable[]) total = show_menu(cmdtable); - outmsg(mystatus); + show_status(); lastcmdptr = pos = 0; do { @@ -296,7 +304,7 @@ domenu(int cmdmode, char *cmdtitle, int cmd, commands_t cmdtable[]) show_menu(cmdtable); - outmsg(mystatus); + show_status(); refscreen = NA; } cursor_clear(menu_row + pos, menu_column); |