summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/edit.c2
-rw-r--r--mbbsd/mbbsd.c2
-rw-r--r--mbbsd/menu.c2
-rw-r--r--mbbsd/more.c80
-rw-r--r--mbbsd/screen.c83
-rw-r--r--mbbsd/stuff.c10
-rw-r--r--mbbsd/user.c9
-rw-r--r--mbbsd/var.c5
8 files changed, 49 insertions, 144 deletions
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 637b7736..a1e2a2a8 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1138,7 +1138,7 @@ display_buffer()
if (inblock)
outs("\033[m");
} else
- outch('~');
+ outc('~');
}
edit_msg();
}
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 897d6d13..f96f5eff 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1066,8 +1066,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 2040e35d..c2d12e55 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -380,8 +380,6 @@ const 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 9718be20..1524ba28 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,45 @@ 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"
+ 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 +257,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 a9089f4e..8c91434b 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -15,15 +15,11 @@ static int scrollcnt, tc_col, tc_line;
#define MODIFIED (1) /* if line has been modifed, screen output */
#define STANDOUT (2) /* if this line has a standout region */
-int tputs(const char *str, int affcnt, int (*putc) (int));
void
initscr()
{
if (!big_picture) {
- scr_lns = t_lines;
- scr_cols = ANSILINELEN;
- /* scr_cols = MIN(t_columns, ANSILINELEN); */
big_picture = (screenline_t *) calloc(scr_lns, sizeof(screenline_t));
docls = YEA;
}
@@ -268,7 +264,7 @@ clrtobot()
}
void
-outch(unsigned char c)
+outc(unsigned char c)
{
register screenline_t *slp;
register int i;
@@ -302,7 +298,7 @@ outch(unsigned char c)
}
if (slp->data[cur_col] != c) {
slp->data[cur_col] = c;
- if ((slp->mode & MODIFIED) != MODIFIED)
+ if (!(slp->mode & MODIFIED))
slp->smod = slp->emod = cur_col;
slp->mode |= MODIFIED;
if (cur_col > slp->emod)
@@ -321,86 +317,13 @@ outch(unsigned char c)
}
}
-static void
-parsecolor(char *buf)
-{
- char *val;
- char data[24];
-
- data[0] = '\0';
- val = (char *)strtok(buf, ";");
-
- while (val) {
- if (atoi(val) < 30) {
- if (data[0])
- strcat(data, ";");
- strcat(data, val);
- }
- 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);
return 0;
}
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index 4d5a1a8f..a0b6b47e 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -613,16 +613,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 19cc6d90..12fe24e4 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -700,15 +700,6 @@ u_info()
}
int
-u_ansi()
-{
- showansi ^= 1;
- cuser.uflag ^= COLOR_FLAG;
- outs(reset_color);
- return 0;
-}
-
-int
u_cloak()
{
outs((currutmp->invisible ^= 1) ? MSG_CLOAKED : MSG_UNCLOAK);
diff --git a/mbbsd/var.c b/mbbsd/var.c
index 66d61e9e..fee645bd 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -79,7 +79,6 @@ char * const str_permboard[] = {
int usernum;
int currmode = 0;
int curredit = 0;
-int showansi = 1;
int paste_level;
int currbid;
char quote_file[80] = "\0";
@@ -400,9 +399,9 @@ int chc_my, chc_turn, chc_selected, chc_firststep;
char chc_warnmsg[64], *chc_mateid;
/* screen.c */
+#define scr_lns t_lines
+#define scr_cols ANSILINELEN
screenline_t *big_picture = NULL;
-unsigned char scr_lns;
-unsigned short scr_cols;
char roll;
/* gomo.c */