From a256051f8a6cab0987d3078a8ceda2fa2b981472 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Wed, 6 Apr 2005 20:50:00 +0000 Subject: [PATCH] Added more Chinese support --- AUTHORS | 1 + ChangeLog | 7 +++++++ Makefile | 4 ++++ config.h.in | 2 ++ configure | 25 +++++++++++++++++++++++++ configure.in | 17 +++++++++++++++++ lib/mbselib.h | 4 ++++ mbsebbs/chat.c | 21 +++++++++++---------- mbsebbs/fsedit.c | 2 +- mbsebbs/input.c | 17 +++++++++++++---- mbsetup/m_lang.c | 10 ++++++++++ 11 files changed, 95 insertions(+), 15 deletions(-) diff --git a/AUTHORS b/AUTHORS index ce4f0f04..63d7b367 100644 --- a/AUTHORS +++ b/AUTHORS @@ -52,3 +52,4 @@ Phil Kimble kimerud@users.sourceforge.net 1:14/200@fidonet David Gonzalez skynetbbs@007mundo.com 4:930/1@fidonet Malte Tychsen 2:240/9350@fidonet Dmitry Komissaroff rsprog@mail.ru +skyroam skyroam@users.sourceforge.net diff --git a/ChangeLog b/ChangeLog index 49067d22..d1be9742 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,7 @@ v0.71.2 16-Jan-2005 Allowed hi-ascii input characters in the internal fs editor, the chat input and one general input function. This may have effects for all users not using us-ascii keyboards. + Added more support for Chinese using the traduce function. mbfido: Empty *.msg netmails for our own system are dropped with and @@ -50,9 +51,15 @@ v0.71.2 16-Jan-2005 The created semafore files are now world readable so that low privileged users like nobody can check the semafore's. + mbsetup: + Added langugae defaults for Chinese. + html: Added batch file upload written by Russell Tiedt to the faq. + lang: + Added Chinese language. + script: Fixed the Slackware setup script that didn't make the startup symlinks in runlevel 4 if the directory /etc/rc.d/rc4.d didn't diff --git a/Makefile b/Makefile index a02ee2ff..9e82f964 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,10 @@ install: @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/log @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/tmp @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/home + @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/chinese + @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/chinese/txtfiles + @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/chinese/menus + @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/chinese/macro @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/dutch @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/dutch/txtfiles @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/dutch/menus diff --git a/config.h.in b/config.h.in index fdad61fe..2f49a230 100644 --- a/config.h.in +++ b/config.h.in @@ -250,3 +250,5 @@ /* Define if machine is bigendian */ #undef WORDS_BIGENDIAN +/* Define if Del != 207 */ +#define GBK_DEL @GBK_DEL@ diff --git a/configure b/configure index 3cecca38..3c6176ec 100755 --- a/configure +++ b/configure @@ -846,6 +846,7 @@ Optional Features: --enable-optimize Enable CPU optimize --enable-newbinkp Compile Debugging Binkp code --enable-newsgate Compile with newsgate + --enable-gbkdel Delete key is 126 (default is 207) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -3076,6 +3077,7 @@ else NEWSGATE="No" fi + echo "$as_me:$LINENO: checking for re_comp in -lcompat" >&5 echo $ECHO_N "checking for re_comp in -lcompat... $ECHO_C" >&6 if test "${ac_cv_lib_compat_re_comp+set}" = set; then @@ -8929,6 +8931,27 @@ echo "${ECHO_T}no" >&6 fi +# Check whether --enable-gbkdel or --disable-gbkdel was given. +if test "${enable_gbkdel+set}" = set; then + enableval="$enable_gbkdel" + gbkdel=$enableval +else + gbkdel=no +fi; +if test "$gbkdel" = "yes"; then + GBK_DEL=126 + DEL=$GBK_DEL + echo "checking delete key... changed into $DEL" +else + DEL="default" + GBK_DEL=0 + echo "checking delete key... default" +fi +cat >>confdefs.h <<_ACEOF +#define GBK_DEL $GBK_DEL +_ACEOF + + # Check whether --with-log-compress or --without-log-compress was given. if test "${with_log_compress+set}" = set; then @@ -10336,6 +10359,7 @@ echo "$as_me:$LINENO: result: Version : ..................... ${VERSION} Hydra/Binkp zlib compression : ${ZLIBSUP} Full newsgate : ............... ${NEWSGATE} + Delete key : .................. ${DEL} " >&5 echo "${ECHO_T} @@ -10346,6 +10370,7 @@ echo "${ECHO_T} Version : ..................... ${VERSION} Hydra/Binkp zlib compression : ${ZLIBSUP} Full newsgate : ............... ${NEWSGATE} + Delete key : .................. ${DEL} " >&6 diff --git a/configure.in b/configure.in index 1cb6089b..1f6e3a42 100644 --- a/configure.in +++ b/configure.in @@ -109,6 +109,7 @@ else NEWSGATE="No" fi + dnl dnl Checks for libraries and functions. dnl @@ -288,6 +289,21 @@ AC_PATH_PROG(GOLDNODE,goldnode) AC_PATH_PROG(GOLDNODE,gnlnx) AC_PATH_PROG(CONVERT,convert) +dnl +dnl FIX DEL for Del!=207, this was default upto 207 or 126 if no argument +dnl +AC_ARG_ENABLE(gbkdel, [ --enable-gbkdel Delete key is 126 (default is 207)], [ gbkdel=$enableval ], [ gbkdel=no ]) +if test "$gbkdel" = "yes"; then + GBK_DEL=126 + DEL=$GBK_DEL + echo "checking delete key... changed into $DEL" +else + DEL="default" + GBK_DEL=0 + echo "checking delete key... default" +fi +AC_DEFINE_UNQUOTED(GBK_DEL,$GBK_DEL) + dnl AC_ARG_WITH(log-compress,[ --with-log-compress=METHOD Log compression method (default gzip)], LOG_COMPRESS=$with_log_compress, LOG_COMPRESS=gzip) case "$LOG_COMPRESS" in @@ -381,6 +397,7 @@ AC_MSG_RESULT([ Version : ..................... ${VERSION} Hydra/Binkp zlib compression : ${ZLIBSUP} Full newsgate : ............... ${NEWSGATE} + Delete key : .................. ${DEL} ]) diff --git a/lib/mbselib.h b/lib/mbselib.h index eb7cd5b4..7db8e1b0 100644 --- a/lib/mbselib.h +++ b/lib/mbselib.h @@ -293,7 +293,11 @@ struct icmp_filter { #define KEY_HOME 204 #define KEY_END 205 #define KEY_INS 206 +#if GBK_DEL +#define KEY_DEL GBK_DEL +#else #define KEY_DEL 207 +#endif #define KEY_PGUP 208 #define KEY_PGDN 209 #define KEY_F10 210 diff --git a/mbsebbs/chat.c b/mbsebbs/chat.c index 7a8331c4..a19b857e 100644 --- a/mbsebbs/chat.c +++ b/mbsebbs/chat.c @@ -279,16 +279,7 @@ void Chat(char *username, char *channel) * Allow hi-ascii for multi-language. */ ch = testkey(exitinfo.iScreenLen -1, curpos + 2); - if (isprint(ch) || (ch > 0x7F)) { - alarm_on(); - if (curpos < 77) { - PUTCHAR(ch); - sbuf[curpos] = ch; - curpos++; - } else { - PUTCHAR(7); - } - } else if ((ch == KEY_BACKSPACE) || (ch == KEY_RUBOUT) || (ch == KEY_DEL)) { + if ((ch == KEY_BACKSPACE) || (ch == KEY_RUBOUT) || (ch == KEY_DEL)) { alarm_on(); if (curpos) { curpos--; @@ -297,6 +288,16 @@ void Chat(char *username, char *channel) } else { PUTCHAR(7); } + /* if KEY_DEL isprint, do no output again */ + } else if (isprint(ch) || traduce(&ch)) { + alarm_on(); + if (curpos < 77) { + PUTCHAR(ch); + sbuf[curpos] = ch; + curpos++; + } else { + PUTCHAR(7); + } } else if ((ch == '\r') && curpos) { alarm_on(); sprintf(buf, "CPUT:2,%d,%s;", mypid, sbuf); diff --git a/mbsebbs/fsedit.c b/mbsebbs/fsedit.c index e239593b..803a1226 100644 --- a/mbsebbs/fsedit.c +++ b/mbsebbs/fsedit.c @@ -212,7 +212,7 @@ void GetstrLC(char *sStr, int iMaxlen) } } - if (ch > 31 && ch < 127) { + if ((ch > 31 && ch < 127) || traduce(&ch)) { if (iPos <= iMaxlen) { iPos++; sprintf(sStr, "%s%c", sStr, ch); diff --git a/mbsebbs/input.c b/mbsebbs/input.c index f2328747..6aa2213b 100644 --- a/mbsebbs/input.c +++ b/mbsebbs/input.c @@ -295,7 +295,7 @@ int traduce(char *ch) { int i; - for (i = 0; i < 85; i++){ + for (i = 0; i < 81; i++){ if ( Language(35)[i] == '\0' ) break; if ( *ch == Language(35)[i] ){ if ( Language(36)[i] != '\0'){ @@ -303,7 +303,17 @@ int traduce(char *ch) } return TRUE; } + } + for (i = 0; i < 81; i++){ + if ( Language(33)[i] == '\0' ) break; + if ( *ch == Language(33)[i] ){ + if ( Language(34)[i] != '\0'){ + *ch = ( Language(34)[i] ); + } + return TRUE; + } } + return FALSE; } @@ -332,16 +342,15 @@ void GetstrP(char *sStr, int iMaxLen, int Position) while (ch != KEY_ENTER) { ch = Readkey(); - if ((ch == KEY_BACKSPACE) || (ch == KEY_DEL) || (ch == KEY_RUBOUT)) { if (iPos > 0) { BackErase(); sStr[--iPos] = '\0'; } else PUTCHAR('\007'); - } - if ((ch > 31) || traduce(&ch)) { + /* if 13 < DEL < 127 , should not output again */ + } else if ((ch > 31 && ch < 127) || traduce(&ch)) { if (iPos <= iMaxLen) { iPos++; sprintf(sStr, "%s%c", sStr, ch); diff --git a/mbsetup/m_lang.c b/mbsetup/m_lang.c index d4cc5a6d..4d87669c 100644 --- a/mbsetup/m_lang.c +++ b/mbsetup/m_lang.c @@ -133,6 +133,16 @@ int CountLanguage(void) lang.Available = TRUE; fwrite(&lang, sizeof(lang), 1, fil); + memset(&lang, 0, sizeof(lang)); + sprintf(lang.Name, "Chinese"); + sprintf(lang.LangKey, "C"); + sprintf(lang.MenuPath, "%s/chinese/menus", getenv("MBSE_ROOT")); + sprintf(lang.TextPath, "%s/chinese/txtfiles", getenv("MBSE_ROOT")); + sprintf(lang.MacroPath, "%s/chinese/macro", getenv("MBSE_ROOT")); + sprintf(lang.Filename, "chinese.lang"); + lang.Available = TRUE; + fwrite(&lang, sizeof(lang), 1, fil); + fclose(fil); chmod(ffile, 0640); return 6;