summaryrefslogtreecommitdiffstats
path: root/mbbsd/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/io.c')
-rw-r--r--mbbsd/io.c39
1 files changed, 6 insertions, 33 deletions
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 41ce6813..97ddb35d 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -17,37 +17,10 @@ static int icurrchar = 0;
/* ----------------------------------------------------- */
/* convert routines */
/* ----------------------------------------------------- */
-#ifdef GB_CONVERT
+#ifdef CONVERT
-typedef int (* read_write_type)(int, void *, size_t);
-static read_write_type write_type = (read_write_type)write;
-static read_write_type read_type = read;
-
-int converting_read(int fd, void *buf, size_t count)
-{
- int len = read(fd, buf, count);
- if (len >= 0)
- gb2big(buf, len);
- return len;
-}
-
-int converting_write(int fd, void *buf, size_t count)
-{
- big2gb(buf, count);
- return write(fd, buf, count);
-}
-
-void set_converting_type(int which)
-{
- if (which == 0) {
- read_type = read;
- write_type = (read_write_type)write;
- }
- else if (which == 1) {
- read_type = converting_read;
- write_type = converting_write;
- }
-}
+read_write_type write_type = (read_write_type)write;
+read_write_type read_type = read;
inline static int read_wrapper(int fd, void *buf, size_t count) {
return (*read_type)(fd, buf, count);
@@ -65,7 +38,7 @@ void
oflush()
{
if (obufsize) {
-#ifdef GB_CONVERT
+#ifdef CONVERT
write_wrapper(1, outbuf, obufsize);
#else
write(1, outbuf, obufsize);
@@ -87,7 +60,7 @@ output(char *s, int len)
assert(len<OBUFSIZE);
if (obufsize + len > OBUFSIZE) {
-#ifdef GB_CONVERT
+#ifdef CONVERT
write_wrapper(1, outbuf, obufsize);
#else
write(1, outbuf, obufsize);
@@ -193,7 +166,7 @@ dogetch()
do{
#endif
-#ifdef GB_CONVERT
+#ifdef CONVERT
while ((len = read_wrapper(0, inbuf, IBUFSIZE)) <= 0) {
#else
while ((len = read(0, inbuf, IBUFSIZE)) <= 0) {