summaryrefslogtreecommitdiffstats
path: root/mbbsd/more.c
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-12 01:18:06 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-12 01:18:06 +0800
commit70cf9252dde3bce8bf18d7edf2fbb9e5083c592a (patch)
tree8649ecae5610778d011c779312921f209c43eec2 /mbbsd/more.c
parent06339dd4de0682da69813f9dfaa10a7fd46f7fd4 (diff)
downloadpttbbs-70cf9252dde3bce8bf18d7edf2fbb9e5083c592a.tar
pttbbs-70cf9252dde3bce8bf18d7edf2fbb9e5083c592a.tar.gz
pttbbs-70cf9252dde3bce8bf18d7edf2fbb9e5083c592a.tar.bz2
pttbbs-70cf9252dde3bce8bf18d7edf2fbb9e5083c592a.tar.lz
pttbbs-70cf9252dde3bce8bf18d7edf2fbb9e5083c592a.tar.xz
pttbbs-70cf9252dde3bce8bf18d7edf2fbb9e5083c592a.tar.zst
pttbbs-70cf9252dde3bce8bf18d7edf2fbb9e5083c592a.zip
merge back from victor.screen branch
remove showansi option git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2060 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/more.c')
-rw-r--r--mbbsd/more.c80
1 files changed, 38 insertions, 42 deletions
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();