summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-01 11:51:01 +0800
committerscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-01 11:51:01 +0800
commit12b4a208d439d19f17c46a31f04b23f3c088898e (patch)
treeaa2b5037ebc0c9d311d423b9f40802e4bfaad733 /mbbsd
parent0f22ab6d1a36658633ab56eb1bf5b49575e57eb5 (diff)
downloadpttbbs-12b4a208d439d19f17c46a31f04b23f3c088898e.tar
pttbbs-12b4a208d439d19f17c46a31f04b23f3c088898e.tar.gz
pttbbs-12b4a208d439d19f17c46a31f04b23f3c088898e.tar.bz2
pttbbs-12b4a208d439d19f17c46a31f04b23f3c088898e.tar.lz
pttbbs-12b4a208d439d19f17c46a31f04b23f3c088898e.tar.xz
pttbbs-12b4a208d439d19f17c46a31f04b23f3c088898e.tar.zst
pttbbs-12b4a208d439d19f17c46a31f04b23f3c088898e.zip
Fix bug in r1654, which is reverted in r1662.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1664 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/more.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/mbbsd/more.c b/mbbsd/more.c
index 0bdb361c..ace229ee 100644
--- a/mbbsd/more.c
+++ b/mbbsd/more.c
@@ -54,10 +54,10 @@ more_readln(int fd, unsigned char *buf)
int ch;
unsigned char *data, *tail, *cc;
- int len, bytes, in_ansi;
+ int len, bytes, in_ansi, in_big5;
int size, head, ansilen;
- len = bytes = in_ansi = ansilen = 0;
+ len = bytes = in_ansi = in_big5 = ansilen = 0;
tail = buf + ANSILINELEN - 1;
size = more_size;
head = more_head;
@@ -102,12 +102,27 @@ more_readln(int fd, unsigned char *buf)
*buf++ = ch;
if (!strchr(STR_ANSICODE, ch))
in_ansi = 0;
+ } else if (in_big5) {
+ ++len;
+ *buf++ = ch;
+ in_big5 = 0;
} else if (isprint2(ch)) {
len++;
*buf++ = ch;
+ if (ch >= 0xa1 && ch <= 0xf9) /* first byte of big5 encoding */
+ in_big5 = 1;
}
} while (len < t_columns && buf < tail);
- if(len==t_columns && head<size && *data=='\n') {
+
+ if (in_big5) {
+ strcpy(buf - 1, "\033[1;34m>\033[m");
+ buf += 10;
+ --head;
+ --data;
+ --bytes;
+ }
+
+ if (len == t_columns && head < size && *data == '\n') {
/* XXX: not handle head==size, should read data */
/* no extra newline dirty hack for exact 80byte line */
data++; bytes++; head++;