summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-28 13:47:34 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-28 13:47:34 +0800
commit94ee5b0f546ecdb6558a4d24028c728997c175e2 (patch)
treebf6bf1e783fe3c41fadef406ff2168ea86f43002 /mbbsd
parent30edc2d47868e24f54a9505f7eb66c0a42c64b4d (diff)
downloadpttbbs-94ee5b0f546ecdb6558a4d24028c728997c175e2.tar
pttbbs-94ee5b0f546ecdb6558a4d24028c728997c175e2.tar.gz
pttbbs-94ee5b0f546ecdb6558a4d24028c728997c175e2.tar.bz2
pttbbs-94ee5b0f546ecdb6558a4d24028c728997c175e2.tar.lz
pttbbs-94ee5b0f546ecdb6558a4d24028c728997c175e2.tar.xz
pttbbs-94ee5b0f546ecdb6558a4d24028c728997c175e2.tar.zst
pttbbs-94ee5b0f546ecdb6558a4d24028c728997c175e2.zip
1.#ifdef GQ_CONVERT
2.add info to FAQ git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1380 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/convert.c3
-rw-r--r--mbbsd/io.c16
-rw-r--r--mbbsd/mbbsd.c11
3 files changed, 28 insertions, 2 deletions
diff --git a/mbbsd/convert.c b/mbbsd/convert.c
index c7140d03..6e620e23 100644
--- a/mbbsd/convert.c
+++ b/mbbsd/convert.c
@@ -3,6 +3,8 @@
* The following code is copied and modified from "autoconvert" with GPL.
*/
+#ifdef GB_CONVERT
+
#include "convert.h"
#define BtoG_bad1 0xa1
@@ -64,3 +66,4 @@ unsigned char *big2gb(unsigned char *s, int plen)
unsigned char c = 0;
return hzconvert(s, &plen, &c, b2g);
}
+#endif
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 273017b8..f31d5f30 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -17,6 +17,8 @@ static int icurrchar = 0;
/* ----------------------------------------------------- */
/* convert routines */
/* ----------------------------------------------------- */
+#ifdef GB_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;
@@ -54,6 +56,7 @@ inline static int read_wrapper(int fd, void *buf, size_t count) {
inline static int write_wrapper(int fd, void *buf, size_t count) {
return (*write_type)(fd, buf, count);
}
+#endif
/* ----------------------------------------------------- */
/* output routines */
@@ -62,7 +65,11 @@ void
oflush()
{
if (obufsize) {
+#ifdef GB_CONVERT
write_wrapper(1, outbuf, obufsize);
+#else
+ write(1, outbuf, obufsize);
+#endif
obufsize = 0;
}
}
@@ -80,7 +87,11 @@ output(char *s, int len)
assert(len<OBUFSIZE);
if (obufsize + len > OBUFSIZE) {
+#ifdef GB_CONVERT
write_wrapper(1, outbuf, obufsize);
+#else
+ write(1, outbuf, obufsize);
+#endif
obufsize = 0;
}
memcpy(outbuf + obufsize, s, len);
@@ -175,7 +186,12 @@ dogetch()
#ifdef SKIP_TELNET_CONTROL_SIGNAL
do{
#endif
+
+#ifdef GB_CONVERT
while ((len = read_wrapper(0, inbuf, IBUFSIZE)) <= 0) {
+#else
+ while ((len = read(0, inbuf, IBUFSIZE)) <= 0) {
+#endif
if (len == 0 || errno != EINTR)
abort_bbs(0);
/* raise(SIGHUP); */
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 2bfb225b..edd2f36d 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -498,9 +498,14 @@ inline static void mkuserdir(char *userid)
static void
login_query()
{
+#ifdef GB_CONVERT
/* uid 加一位, for gb login */
char uid[IDLEN + 2], passbuf[PASSLEN];
int attempts, len;
+#else
+ char uid[IDLEN + 1], passbuf[PASSLEN];
+ int attempts;
+#endif
resolve_garbage();
now = time(0);
@@ -528,14 +533,16 @@ login_query()
getdata(20, 0, "請輸入代號,或以[guest]參觀,以[new]註冊:",
uid, sizeof(uid), DOECHO);
+#ifdef GB_CONVERT
/* switch to gb mode if uid end with '.' */
len = strlen(uid);
if (uid[0] && uid[len - 1] == '.') {
set_converting_type(1);
uid[len - 1] = 0;
}
- else if (len == IDLEN + 1)
- uid[len - 1] = 0;
+ else if (len >= IDLEN + 1)
+ uid[IDLEN] = 0;
+#endif
if (strcasecmp(uid, str_new) == 0) {
#ifdef LOGINASNEW