From cbc07c65e3399ce8c1e3fbc6c5fe8cc3268f3d01 Mon Sep 17 00:00:00 2001 From: victor Date: Sun, 30 May 2004 03:29:47 +0000 Subject: rm showansi git-svn-id: http://opensvn.csie.org/pttbbs/branches/victor.screen@2033 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/edit.c | 2 +- mbbsd/mbbsd.c | 2 - mbbsd/menu.c | 2 - mbbsd/more.c | 81 +++++++++++++++++++-------------------- mbbsd/screen.c | 119 ++++++++------------------------------------------------- mbbsd/stuff.c | 10 ++--- mbbsd/user.c | 9 ----- mbbsd/var.c | 1 - 8 files changed, 60 insertions(+), 166 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 6b8d900e..8f5a9cee 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1139,7 +1139,7 @@ display_buffer() if (inblock) outs("\033[m"); } else - outch('~'); + outc('~'); } edit_msg(); } diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 062908b1..151bf6e9 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1064,8 +1064,6 @@ start_client() b_closepolls(); SHM->close_vote_time = now; } - if (!(cuser.uflag & COLOR_FLAG)) - showansi = 0; signal(SIGALRM, SIG_IGN); domenu(MMENU, "主功\能表", (currutmp->mailalert ? 'M' : 'C'), cmdlist); diff --git a/mbbsd/menu.c b/mbbsd/menu.c index 38a5801f..5ca557d7 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -381,8 +381,6 @@ static commands_t userlist[] = { {calendar, PERM_LOGINOK, "CCalendar 個人行事曆"}, {u_editcalendar, PERM_LOGINOK, "CDEditCalendar 編輯個人行事曆"}, {u_loginview, PERM_LOGINOK, "LLogin View 選擇進站畫面"}, - {u_ansi, 0, "AANSI 切換 ANSI \033[36m彩\033[35m色\033[37m/" - "\033[30;47m黑\033[1;37m白\033[m模示"}, {u_movie, 0, "MMovie 切換動畫模示"}, #ifdef HAVE_SUICIDE {u_kill, PERM_BASIC, "IKill 自殺!!"}, diff --git a/mbbsd/more.c b/mbbsd/more.c index c55d6220..adae1720 100644 --- a/mbbsd/more.c +++ b/mbbsd/more.c @@ -91,13 +91,11 @@ more_readln(int fd, unsigned char *buf) bytes += ch; } } else { - if (showansi) - *buf++ = ch; + *buf++ = ch; in_ansi = 1; } } else if (in_ansi) { - if (showansi) - *buf++ = ch; + *buf++ = ch; if (!strchr(STR_ANSICODE, ch)) in_ansi = 0; } else if (in_big5) { @@ -179,47 +177,46 @@ more(char *fpath, int promptend) } if (numbytes) { /* 一般資料處理 */ if (!viewed) { /* begin of file */ - if (showansi) { /* header processing */ - if (!strncmp(buf, str_author1, LEN_AUTHOR1)) { - line = 3; - word = buf + LEN_AUTHOR1; - local = 1; - } else if (!strncmp(buf, str_author2, LEN_AUTHOR2)) { - line = 4; - word = buf + LEN_AUTHOR2; - } - while (pos < line) { - if (!pos && ((ptr = strstr(word, str_post1)) || - (ptr = strstr(word, str_post2)))) { - ptr[-1] = '\0'; - prints("\033[47;34m %s \033[44;37m%-53.53s" + /* header processing */ + if (!strncmp(buf, str_author1, LEN_AUTHOR1)) { + line = 3; + word = buf + LEN_AUTHOR1; + local = 1; + } else if (!strncmp(buf, str_author2, LEN_AUTHOR2)) { + line = 4; + word = buf + LEN_AUTHOR2; + } + while (pos < line) { + if (!pos && ((ptr = strstr(word, str_post1)) || + (ptr = strstr(word, str_post2)))) { + ptr[-1] = '\0'; + prints("\033[47;34m %s \033[44;37m%-53.53s" "\033[47;34m %.4s \033[44;37m%-13s\033[m\n", - head[0], word, ptr, ptr + 5); - } else if (pos < line) - prints("\033[47;34m %s \033[44;37m%-72.72s" - "\033[m\n", head[pos], word); - - viewed += numbytes; - numbytes = more_readln(fd, (unsigned char *)buf); - - /* 第一行太長了 */ - if (!pos && viewed > 79) { - /* 第二行不是 [標....] */ - if (memcmp(buf, head[1], 2)) { - /* 讀下一行進來處理 */ - viewed += numbytes; - numbytes = more_readln(fd, (unsigned char *)buf); - } + head[0], word, ptr, ptr + 5); + } else if (pos < line) + prints("\033[47;34m %s \033[44;37m%-72.72s" + "\033[m\n", head[pos], word); + + viewed += numbytes; + numbytes = more_readln(fd, (unsigned char *)buf); + + /* 第一行太長了 */ + if (!pos && viewed > 79) { + /* 第二行不是 [標....] */ + if (memcmp(buf, head[1], 2)) { + /* 讀下一行進來處理 */ + viewed += numbytes; + numbytes = more_readln(fd, (unsigned char *)buf); } - pos++; } - if (pos) { - header = 1; + pos++; + } + if (pos) { + header = 1; - prints("\033[36m%s\033[m\n", msg_seperator); - ++line; - ++pos; - } + prints("\033[36m%s\033[m\n", msg_seperator); + ++line; + ++pos; } lino = pos; word = NULL; @@ -261,7 +258,7 @@ more(char *fpath, int promptend) outs("\033[m"); word = NULL; } - outch('\n'); + outc('\n'); if (beep) { bell(); diff --git a/mbbsd/screen.c b/mbbsd/screen.c index 91c5921a..a96b9f99 100644 --- a/mbbsd/screen.c +++ b/mbbsd/screen.c @@ -77,40 +77,6 @@ rel_move(int was_col, int was_ln, int new_col, int new_ln) do_move(new_col, new_ln); } -static void -standoutput(char *buf, int ds, int de, int sso, int eso) -{ - if (eso <= ds || sso >= de) { - output(buf + ds, de - ds); - } else { -#if 0 - if (sso > ds) // does is not happened? - output(buf + ds, sso - ds); - else - vmsg("!!!!!!"); - o_standup(); - output(buf + sso, de - sso); - o_standdown(); - if (de > eso) // does is not happened? - output(buf + eso, de - eso); - else - vmsg("!!!!!!"); -#else - short st_start, st_end; - - st_start = MAX(sso, ds); - st_end = MIN(eso, de); - if (sso > ds) - output(buf + ds, sso - ds); - o_standup(); - output(buf + st_start, st_end - st_start); - o_standdown(); - if (de > eso) - output(buf + eso, de - eso); -#endif - } -} - void redoscr() { @@ -125,7 +91,7 @@ redoscr() if ((len = bp->len)) { rel_move(tc_col, tc_line, 0, i); if (bp->mode & STANDOUT) { - standoutput((char *)bp->data, 0, len, bp->sso, bp->eso); +// standoutput((char *)bp->data, 0, len, bp->sso, bp->eso); } else output((char *)bp->data, len); @@ -190,9 +156,9 @@ refresh() bp->emod = len - 1; rel_move(tc_col, tc_line, bp->smod, i); - if (bp->mode & STANDOUT) - standoutput((char *)bp->data, bp->smod, bp->emod + 1, - bp->sso, bp->eso); + if (bp->mode & STANDOUT) { +// standoutput((char *)bp->data, bp->smod, bp->emod + 1, bp->sso, bp->eso); + } else output((char *)&bp->data[bp->smod], bp->emod - bp->smod + 1); tc_col = bp->emod + 1; @@ -286,7 +252,7 @@ clrtobot() } void -outch(unsigned char c) +outc(unsigned char c) { register screenline_t *slp; register int i; @@ -351,85 +317,24 @@ parsecolor(char *buf) while (val) { if (atoi(val) < 30) { -#if 0 if (data[0]) { data[len++] = ';'; data[len] = 0; } strcpy(&data[len], val); -#else - if (data[0]) { - data[len++] = ';'; - data[len] = 0; - } - strcpy(&data[len], val); -#endif } val = (char *)strtok(NULL, ";"); } strlcpy(buf, data, sizeof(data)); } -#define NORMAL (00) -#define ESCAPE (01) -#define VTKEYS (02) - -void -outc(unsigned char ch) -{ - if (showansi) - outch(ch); - else { - static char buf[24]; - static int p = 0; - static int mode = NORMAL; - int i; - - switch (mode) { - case NORMAL: - if (ch == '\033') - mode = ESCAPE; - else - outch(ch); - return; - case ESCAPE: - if (ch == '[') - mode = VTKEYS; - else { - mode = NORMAL; - outch(''); - outch(ch); - } - return; - case VTKEYS: - if (ch == 'm') { - buf[p++] = '\0'; - parsecolor(buf); - } else if (((size_t)p < sizeof(buf)) && (not_alpha(ch))) { - buf[p++] = ch; - return; - } - if (buf[0]) { - outch(''); - outch('['); - - for (i = 0; buf[i]; i++) - outch(buf[i]); - outch(ch); - } - p = 0; - mode = NORMAL; - } - } -} - int edit_outs(const char *text) { register int column = 0; register char ch; while ((ch = *text++) && (++column < t_columns)) - outch(ch == 27 ? '*' : ch); + outc(ch == 27 ? '*' : ch); /* 27 == ESC */ return 0; } @@ -528,10 +433,11 @@ region_scroll_up(int top, int bottom) refresh(); } -/* 開始反白 - 瑩幕上之後的訊息開始反白輸出,會寫在 screenline_t 上。 */ +/* 開始反白 */ void standout() { +#if 1 if (!standing && strtstandoutlen) { register screenline_t *slp; @@ -540,13 +446,16 @@ standout() slp->sso = slp->eso = cur_col; slp->mode |= STANDOUT; } -// outs(strtstandout); +#else + outs(strtstandout); +#endif } /* 結束反白 */ void standend() { +#if 1 if (standing && strtstandoutlen) { register screenline_t *slp; @@ -554,5 +463,7 @@ standend() standing = NA; slp->eso = MAX(slp->eso, cur_col); } -// outs(endstandout); +#else + outs(endstandout); +#endif } diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index 9e7e1c5a..8e6bc461 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -596,16 +596,16 @@ printdash(char *mesg) tail = head; while (head++ < 38) - outch('-'); + outc('-'); if (tail) { - outch(' '); + outc(' '); outs(mesg); - outch(' '); + outc(' '); } while (tail++ < 38) - outch('-'); - outch('\n'); + outc('-'); + outc('\n'); } int diff --git a/mbbsd/user.c b/mbbsd/user.c index f73a26be..a618a501 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -699,15 +699,6 @@ u_info() return 0; } -int -u_ansi() -{ - showansi ^= 1; - cuser.uflag ^= COLOR_FLAG; - outs(reset_color); - return 0; -} - int u_cloak() { diff --git a/mbbsd/var.c b/mbbsd/var.c index 8b5dfcc1..d1578e95 100644 --- a/mbbsd/var.c +++ b/mbbsd/var.c @@ -79,7 +79,6 @@ char *str_permboard[] = { int usernum; int currmode = 0; int curredit = 0; -int showansi = 1; int paste_level; int currbid; char quote_file[80] = "\0"; -- cgit v1.2.3