summaryrefslogtreecommitdiffstats
path: root/mbbsd/mbbsd.c
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-01-03 17:53:35 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-01-03 17:53:35 +0800
commit38262b22bfe8cfe1f7de6f272e18a3aae340f83a (patch)
tree819e75228a3d78d922eaaa9a4e81df89219457da /mbbsd/mbbsd.c
parent63bc2dad6f3d3fdb6b3495a4eda10a14a5647c6a (diff)
downloadpttbbs-38262b22bfe8cfe1f7de6f272e18a3aae340f83a.tar
pttbbs-38262b22bfe8cfe1f7de6f272e18a3aae340f83a.tar.gz
pttbbs-38262b22bfe8cfe1f7de6f272e18a3aae340f83a.tar.bz2
pttbbs-38262b22bfe8cfe1f7de6f272e18a3aae340f83a.tar.lz
pttbbs-38262b22bfe8cfe1f7de6f272e18a3aae340f83a.tar.xz
pttbbs-38262b22bfe8cfe1f7de6f272e18a3aae340f83a.tar.zst
pttbbs-38262b22bfe8cfe1f7de6f272e18a3aae340f83a.zip
support utf8 convertion, but still buggy
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1456 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mbbsd.c')
-rw-r--r--mbbsd/mbbsd.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 425406f1..5bd1185b 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -512,7 +512,7 @@ inline static void mkuserdir(char *userid)
static void
login_query()
{
-#ifdef GB_CONVERT
+#ifdef CONVERT
/* uid 加一位, for gb login */
char uid[IDLEN + 2], passbuf[PASSLEN];
int attempts, len;
@@ -547,11 +547,15 @@ login_query()
getdata(20, 0, "請輸入代號,或以[guest]參觀,以[new]註冊:",
uid, sizeof(uid), DOECHO);
-#ifdef GB_CONVERT
+#ifdef CONVERT
/* switch to gb mode if uid end with '.' */
len = strlen(uid);
if (uid[0] && uid[len - 1] == '.') {
- set_converting_type(1);
+ set_converting_type(CONV_GB);
+ uid[len - 1] = 0;
+ }
+ else if (uid[0] && uid[len - 1] == ',') {
+ set_converting_type(CONV_UTF8);
uid[len - 1] = 0;
}
else if (len >= IDLEN + 1)
@@ -1337,6 +1341,14 @@ daemon_login(int argc, char *argv[], char *envp[])
setuid(BBSUID);
chdir(BBSHOME);
+ /* It's better to do something before fork */
+#ifdef CONVERT
+ big2gb_init();
+ gb2big_init();
+ big2uni_init();
+ uni2big_init();
+#endif
+
#ifndef NO_FORK
#ifdef PRE_FORK
if( listen_port == 23 ){ // only pre-fork in port 23