summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h4
-rw-r--r--mbbsd/convert.c15
-rw-r--r--mbbsd/edit.c7
-rw-r--r--mbbsd/io.c6
-rw-r--r--mbbsd/menu.c2
-rw-r--r--mbbsd/screen.c52
6 files changed, 18 insertions, 68 deletions
diff --git a/include/proto.h b/include/proto.h
index 53b9c11f..ba5c8b0c 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -283,8 +283,6 @@ int gb_read(int fd, void *buf, size_t count);
int utf8_write(int fd, void *buf, size_t count);
int utf8_read(int fd, void *buf, size_t count);
void set_converting_type(int which);
-unsigned char *gb2big(unsigned char *s, int* plen, int mod);
-unsigned char *big2gb(unsigned char *s, int* plen, int mod);
/* io */
int getdata(int line, int col, char *prompt, char *buf, int len, int echo);
@@ -464,7 +462,7 @@ void rscroll();
void scroll();
void getyx(int *y, int *x);
void initscr();
-void Jaky_outs(char *str, int line);
+void out_lines(char *str, int line);
/* stuff */
time_t gettime(int line, time_t dt, char* head);
diff --git a/mbbsd/convert.c b/mbbsd/convert.c
index 1dd90308..1fcb078f 100644
--- a/mbbsd/convert.c
+++ b/mbbsd/convert.c
@@ -6,12 +6,19 @@
extern read_write_type write_type;
extern read_write_type read_type;
+unsigned char *gb2big(unsigned char *, int* , int);
+unsigned char *big2gb(unsigned char *, int* , int);
+unsigned char *utf8_uni(unsigned char *, int *, int);
+unsigned char *uni_utf8(unsigned char *, int *, int);
+unsigned char *uni2big(unsigned char *, int* , int);
+unsigned char *big2uni(unsigned char *, int* , int);
+
static int gb_read(int fd, void *buf, size_t count)
{
- int len = read(fd, buf, count);
- if (len > 0)
- gb2big((char *)buf, &len, 0);
- return len;
+ count = read(fd, buf, count);
+ if (count > 0)
+ gb2big((char *)buf, &count, 0);
+ return count;
}
static int gb_write(int fd, void *buf, size_t count)
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index bc94d5a9..52d48656 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1040,12 +1040,7 @@ write_file(char *fpath, int saveheader, int *islocal)
}
}
}
-#ifdef SUPPORT_GB
- if (current_font_type == TYPE_GB) {
- fprintf(fp, "%s\n", hc_convert_str(msg, HC_GBtoBIG, HC_DO_SINGLE));
- } else
-#endif
- fprintf(fp, "%s\n", msg);
+ fprintf(fp, "%s\n", msg);
}
}
free(p);
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 30a4a99f..69aa7bbc 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -573,12 +573,6 @@ oldgetdata(int line, int col, char *prompt, char *buf, int len, int echo)
}
if ((echo == LCECHO) && isupper(buf[0]))
buf[0] = tolower(buf[0]);
-#ifdef SUPPORT_GB
- if (echo == DOECHO && current_font_type == TYPE_GB) {
- // FIXME check buffer length
- strcpy(buf, hc_convert_str(buf, HC_GBtoBIG, HC_DO_SINGLE));
- }
-#endif
return clen;
}
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index ae006299..d3fd1484 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -157,7 +157,7 @@ movie(int i)
move(1, 0);
clrtoline(1 + FILMROW); /* 清掉上次的 */
- Jaky_outs(SHM->notes[i], 11); /* 只印11行就好 */
+ out_lines(SHM->notes[i], 11); /* 只印11行就好 */
outs(reset_color);
}
show_status();
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index 24dffc4d..825fb3b7 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -1,10 +1,6 @@
/* $Id$ */
#include "bbs.h"
-#ifdef SUPPORT_GB
-static int current_font_type = TYPE_BIG5;
-static int gbinited = 0;
-#endif
#define o_clear() output(clearbuf,clearbuflen)
#define o_cleol() output(cleolbuf,cleolbuflen)
#define o_scrollrev() output(scrollrev,scrollrevlen)
@@ -264,7 +260,7 @@ clrtoline(int line)
}
}
-void
+inline void
clrtobot()
{
clrtoline(scr_lns);
@@ -397,38 +393,11 @@ outc(unsigned char ch)
}
}
-static void
-do_outs(char *str)
-{
- while (*str) {
- outc(*str++);
- }
-}
-#ifdef SUPPORT_GB
-static void
-gb_init()
-{
- if (current_font_type == TYPE_GB) {
- hc_readtab(BBSHOME "/etc/hc.tab");
- }
- gbinited = 1;
-}
-
-static void
-gb_outs(char *str)
-{
- do_outs(hc_convert_str(str, HC_BIGtoGB, HC_DO_SINGLE));
-}
-#endif
int
edit_outs(char *text)
{
register int column = 0;
register char ch;
-#ifdef SUPPORT_GB
- if (current_font_type == TYPE_GB)
- text = hc_convert_str(text, HC_BIGtoGB, HC_DO_SINGLE);
-#endif
while ((ch = *text++) && (++column < t_columns))
outch(ch == 27 ? '*' : ch);
@@ -438,28 +407,15 @@ edit_outs(char *text)
void
outs(char *str)
{
-#ifdef SUPPORT_GB
- if (current_font_type == TYPE_BIG5)
-#endif
- do_outs(str);
-#ifdef SUPPORT_GB
- else {
- if (!gbinited)
- gb_init();
- gb_outs(str);
+ while (*str) {
+ outc(*str++);
}
-#endif
}
-
/* Jaky */
void
-Jaky_outs(char *str, int line)
+out_lines(char *str, int line)
{
-#ifdef SUPPORT_GB
- if (current_font_type == TYPE_GB)
- str = hc_convert_str(str, HC_BIGtoGB, HC_DO_SINGLE);
-#endif
while (*str && line) {
outc(*str);
if (*str == '\n')