2 Unix SMB/Netbios implementation.
5 Copyright (C) Andrew Tridgell 1992-1998
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 Adding for Japanese language by <fujita@ainix.isac.co.jp> 1994.9.5
22 and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11
23 and add all jis codes sequence type at 1995.8.16
24 Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
31 * Function pointers that get overridden when multi-byte code pages
35 const char *(*multibyte_strchr)(const char *, int ) = (const char *(*)(const char *, int )) strchr;
36 const char *(*multibyte_strrchr)(const char *, int ) = (const char *(*)(const char *, int )) strrchr;
37 const char *(*multibyte_strstr)(const char *, const char *) = (const char *(*)(const char *, const char *)) strstr;
38 char *(*multibyte_strtok)(char *, const char *) = (char *(*)(char *, const char *)) strtok;
41 * Kanji is treated differently here due to historical accident of
42 * it being the first non-English codepage added to Samba.
43 * The define 'KANJI' is being overloaded to mean 'use kanji codepage
44 * by default' and also 'this is the filename-to-disk conversion
45 * method to use'. This really should be removed and all control
46 * over this left in the smb.conf parameters 'client codepage'
47 * and 'coding system'.
53 * Set the default conversion to be the functions in
57 static size_t skip_non_multibyte_char(char);
58 static BOOL not_multibyte_char_1(char);
60 char *(*_dos_to_unix)(char *, BOOL) = dos2unix_format;
61 char *(*_unix_to_dos)(char *, BOOL) = unix2dos_format;
62 size_t (*_skip_multibyte_char)(char) = skip_non_multibyte_char;
63 BOOL (*is_multibyte_char_1)(char) = not_multibyte_char_1;
68 * Set the default conversion to be the function
69 * sj_to_sj in this file.
72 static char *sj_to_sj(char *from, BOOL overwrite);
73 static size_t skip_kanji_multibyte_char(char);
74 static BOOL is_kanji_multibyte_char_1(char);
76 char *(*_dos_to_unix)(char *, BOOL) = sj_to_sj;
77 char *(*_unix_to_dos)(char *, BOOL) = sj_to_sj;
78 size_t (*_skip_multibyte_char)(char) = skip_kanji_multibyte_char;
79 int (*is_multibyte_char_1)(char) = is_kanji_multibyte_char_1;
83 /* jis si/so sequence */
84 static char jis_kso = JIS_KSO;
85 static char jis_ksi = JIS_KSI;
86 static char hex_tag = HEXTAG;
88 /*******************************************************************
90 ********************************************************************/
92 /*******************************************************************
93 search token from S1 separated any char of S2
94 S1 contains SHIFT JIS chars.
95 ********************************************************************/
97 static char *sj_strtok(char *s1, const char *s2)
99 static char *s = NULL;
107 for (q = s1; *s1; ) {
108 if (is_shift_jis (*s1)) {
110 } else if (is_kana (*s1)) {
113 char *p = strchr (s2, *s1);
132 /*******************************************************************
133 search string S2 from S1
134 S1 contains SHIFT JIS chars.
135 ********************************************************************/
137 static const char *sj_strstr(const char *s1, const char *s2)
139 size_t len = strlen (s2);
141 return (const char *) s1;
144 if (strncmp (s1, s2, len) == 0)
145 return (const char *) s1;
147 if (is_shift_jis (*s1)) {
156 /*******************************************************************
157 Search char C from beginning of S.
158 S contains SHIFT JIS chars.
159 ********************************************************************/
161 static const char *sj_strchr (const char *s, int c)
165 return (const char *) s;
166 if (is_shift_jis (*s)) {
175 /*******************************************************************
176 Search char C end of S.
177 S contains SHIFT JIS chars.
178 ********************************************************************/
180 static const char *sj_strrchr(const char *s, int c)
186 q = (const char *) s;
188 if (is_shift_jis (*s)) {
197 /*******************************************************************
198 Kanji multibyte char skip function.
199 *******************************************************************/
201 static size_t skip_kanji_multibyte_char(char c)
203 if(is_shift_jis(c)) {
205 } else if (is_kana(c)) {
211 /*******************************************************************
212 Kanji multibyte char identification.
213 *******************************************************************/
215 static BOOL is_kanji_multibyte_char_1(char c)
217 return is_shift_jis(c);
220 /*******************************************************************
221 The following functions are the only ones needed to do multibyte
222 support for Hangul, Big5 and Simplified Chinese. Most of the
223 real work for these codepages is done in the generic multibyte
224 functions. The only reason these functions are needed at all
225 is that the is_xxx(c) calls are really preprocessor macros.
226 ********************************************************************/
228 /*******************************************************************
229 Hangul (Korean - code page 949) function.
230 ********************************************************************/
232 static BOOL hangul_is_multibyte_char_1(char c)
237 /*******************************************************************
238 Big5 Traditional Chinese (code page 950) function.
239 ********************************************************************/
241 static BOOL big5_is_multibyte_char_1(char c)
243 return is_big5_c1(c);
246 /*******************************************************************
247 Simplified Chinese (code page 936) function.
248 ********************************************************************/
250 static BOOL simpch_is_multibyte_char_1(char c)
252 return is_simpch_c1(c);
255 /*******************************************************************
256 Generic multibyte functions - used by Hangul, Big5 and Simplified
258 ********************************************************************/
260 /*******************************************************************
261 search token from S1 separated any char of S2
262 S1 contains generic multibyte chars.
263 ********************************************************************/
265 static char *generic_multibyte_strtok(char *s1, const char *s2)
267 static char *s = NULL;
275 for (q = s1; *s1; ) {
276 if ((*is_multibyte_char_1)(*s1)) {
279 char *p = strchr (s2, *s1);
298 /*******************************************************************
299 search string S2 from S1
300 S1 contains generic multibyte chars.
301 ********************************************************************/
303 static const char *generic_multibyte_strstr(const char *s1, const char *s2)
305 size_t len = strlen (s2);
307 return (const char *) s1;
310 if (strncmp (s1, s2, len) == 0)
311 return (const char *) s1;
313 if ((*is_multibyte_char_1)(*s1)) {
322 /*******************************************************************
323 Search char C from beginning of S.
324 S contains generic multibyte chars.
325 ********************************************************************/
327 static const char *generic_multibyte_strchr(const char *s, int c)
331 return (const char *) s;
332 if ((*is_multibyte_char_1)(*s)) {
341 /*******************************************************************
342 Search char C end of S.
343 S contains generic multibyte chars.
344 ********************************************************************/
346 static const char *generic_multibyte_strrchr(const char *s, int c)
352 q = (const char *) s;
354 if ((*is_multibyte_char_1)(*s)) {
363 /*******************************************************************
364 Generic multibyte char skip function.
365 *******************************************************************/
367 static size_t skip_generic_multibyte_char(char c)
369 if( (*is_multibyte_char_1)(c)) {
375 /*******************************************************************
377 ********************************************************************/
379 /* convesion buffer */
380 static char cvtbuf[2*sizeof(pstring)];
382 /*******************************************************************
384 ********************************************************************/
386 static int euc2sjis (int hi, int lo)
389 return ((hi / 2 + (hi < 0xdf ? 0x31 : 0x71)) << 8) |
390 (lo - (lo >= 0xe0 ? 0x60 : 0x61));
392 return ((hi / 2 + (hi < 0xdf ? 0x30 : 0x70)) << 8) | (lo - 2);
395 static int sjis2euc (int hi, int lo)
398 return ((hi * 2 - (hi >= 0xe0 ? 0xe0 : 0x60)) << 8) | (lo + 2);
400 return ((hi * 2 - (hi >= 0xe0 ? 0xe1 : 0x61)) << 8) |
401 (lo + (lo >= 0x7f ? 0x60 : 0x61));
404 /*******************************************************************
405 Convert FROM contain SHIFT JIS codes to EUC codes
406 return converted buffer
407 ********************************************************************/
409 static char *sj_to_euc(char *from, BOOL overwrite)
414 save = (char *) from;
415 for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3);) {
416 if (is_shift_jis (*from)) {
417 int code = sjis2euc ((int) from[0] & 0xff, (int) from[1] & 0xff);
418 *out++ = (code >> 8) & 0xff;
421 } else if (is_kana (*from)) {
422 *out++ = (char)euc_kana;
430 pstrcpy((char *) save, (char *) cvtbuf);
431 return (char *) save;
437 /*******************************************************************
438 Convert FROM contain EUC codes to SHIFT JIS codes
439 return converted buffer
440 ********************************************************************/
442 static char *euc_to_sj(char *from, BOOL overwrite)
447 save = (char *) from;
448 for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3); ) {
449 if (is_euc (*from)) {
450 int code = euc2sjis ((int) from[0] & 0xff, (int) from[1] & 0xff);
451 *out++ = (code >> 8) & 0xff;
454 } else if (is_euc_kana (*from)) {
463 pstrcpy(save, (char *) cvtbuf);
470 /*******************************************************************
471 JIS7,JIS8,JUNET <-> SJIS
472 ********************************************************************/
474 static int sjis2jis(int hi, int lo)
477 return ((hi * 2 - (hi >= 0xe0 ? 0x160 : 0xe0)) << 8) | (lo - 0x7e);
479 return ((hi * 2 - (hi >= 0xe0 ? 0x161 : 0xe1)) << 8) |
480 (lo - (lo >= 0x7f ? 0x20 : 0x1f));
483 static int jis2sjis(int hi, int lo)
486 return ((hi / 2 + (hi < 0x5f ? 0x71 : 0xb1)) << 8) |
487 (lo + (lo >= 0x60 ? 0x20 : 0x1f));
489 return ((hi / 2 + (hi < 0x5f ? 0x70 : 0xb0)) << 8) | (lo + 0x7e);
492 /*******************************************************************
493 Convert FROM contain JIS codes to SHIFT JIS codes
494 return converted buffer
495 ********************************************************************/
497 static char *jis8_to_sj(char *from, BOOL overwrite)
504 save = (char *) from;
505 for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3);) {
506 if (is_esc (*from)) {
507 if (is_so1 (from[1]) && is_so2 (from[2])) {
510 } else if (is_si1 (from[1]) && is_si2 (from[2])) {
513 } else { /* sequence error */
527 int code = jis2sjis ((int) from[0] & 0xff, (int) from[1] & 0xff);
528 *out++ = (code >> 8) & 0xff;
539 pstrcpy (save, (char *) cvtbuf);
546 /*******************************************************************
547 Convert FROM contain SHIFT JIS codes to JIS codes
548 return converted buffer
549 ********************************************************************/
551 static char *sj_to_jis8(char *from, BOOL overwrite)
558 save = (char *) from;
559 for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-4); ) {
560 if (is_shift_jis (*from)) {
563 case _KJ_ROMAN: /* to KANJI */
570 code = sjis2jis ((int) from[0] & 0xff, (int) from[1] & 0xff);
571 *out++ = (code >> 8) & 0xff;
576 case _KJ_KANJI: /* to ROMAN/KANA */
588 case _KJ_KANJI: /* to ROMAN/KANA */
597 pstrcpy (save, (char *) cvtbuf);
604 /*******************************************************************
605 Convert FROM contain 7 bits JIS codes to SHIFT JIS codes
606 return converted buffer
607 ********************************************************************/
608 static char *jis7_to_sj(char *from, BOOL overwrite)
615 save = (char *) from;
616 for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3);) {
617 if (is_esc (*from)) {
618 if (is_so1 (from[1]) && is_so2 (from[2])) {
621 } else if (is_si1 (from[1]) && is_si2 (from[2])) {
624 } else { /* sequence error */
627 } else if (is_so (*from)) {
628 shifted = _KJ_KANA; /* to KANA */
630 } else if (is_si (*from)) {
631 shifted = _KJ_ROMAN; /* to ROMAN */
642 int code = jis2sjis ((int) from[0] & 0xff, (int) from[1] & 0xff);
643 *out++ = (code >> 8) & 0xff;
649 *out++ = ((int) from[0]) + 0x80;
656 pstrcpy (save, (char *) cvtbuf);
663 /*******************************************************************
664 Convert FROM contain SHIFT JIS codes to 7 bits JIS codes
665 return converted buffer
666 ********************************************************************/
667 static char *sj_to_jis7(char *from, BOOL overwrite)
674 save = (char *) from;
675 for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-4); ) {
676 if (is_shift_jis (*from)) {
680 *out++ = jis_si; /* to ROMAN and through down */
681 case _KJ_ROMAN: /* to KANJI */
688 code = sjis2jis ((int) from[0] & 0xff, (int) from[1] & 0xff);
689 *out++ = (code >> 8) & 0xff;
692 } else if (is_kana (from[0])) {
694 case _KJ_KANJI: /* to ROMAN */
698 case _KJ_ROMAN: /* to KANA */
703 *out++ = ((int) *from++) - 0x80;
707 *out++ = jis_si; /* to ROMAN */
710 case _KJ_KANJI: /* to ROMAN */
722 *out++ = jis_si; /* to ROMAN */
724 case _KJ_KANJI: /* to ROMAN */
732 pstrcpy (save, (char *) cvtbuf);
739 /*******************************************************************
740 Convert FROM contain 7 bits JIS(junet) codes to SHIFT JIS codes
741 return converted buffer
742 ********************************************************************/
744 static char *junet_to_sj(char *from, BOOL overwrite)
751 save = (char *) from;
752 for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3);) {
753 if (is_esc (*from)) {
754 if (is_so1 (from[1]) && is_so2 (from[2])) {
757 } else if (is_si1 (from[1]) && is_si2 (from[2])) {
760 } else if (is_juk1(from[1]) && is_juk2 (from[2])) {
763 } else { /* sequence error */
775 int code = jis2sjis ((int) from[0] & 0xff, (int) from[1] & 0xff);
776 *out++ = (code >> 8) & 0xff;
782 *out++ = ((int) from[0]) + 0x80;
789 pstrcpy (save, (char *) cvtbuf);
796 /*******************************************************************
797 Convert FROM contain SHIFT JIS codes to 7 bits JIS(junet) codes
798 return converted buffer
799 ********************************************************************/
800 static char *sj_to_junet(char *from, BOOL overwrite)
807 save = (char *) from;
808 for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-4); ) {
809 if (is_shift_jis (*from)) {
813 case _KJ_ROMAN: /* to KANJI */
820 code = sjis2jis ((int) from[0] & 0xff, (int) from[1] & 0xff);
821 *out++ = (code >> 8) & 0xff;
824 } else if (is_kana (from[0])) {
826 case _KJ_KANJI: /* to ROMAN */
827 case _KJ_ROMAN: /* to KANA */
829 *out++ = junet_kana1;
830 *out++ = junet_kana2;
834 *out++ = ((int) *from++) - 0x80;
838 case _KJ_KANJI: /* to ROMAN */
850 case _KJ_KANJI: /* to ROMAN */
858 pstrcpy (save, (char *) cvtbuf);
865 /*******************************************************************
867 ********************************************************************/
868 /* ":xx" -> a byte */
869 static char *hex_to_sj(char *from, BOOL overwrite)
875 while (*sp && (dp - cvtbuf < sizeof(cvtbuf)-3)) {
876 if (*sp == hex_tag && isxdigit((int)sp[1]) && isxdigit((int)sp[2])) {
877 *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2]));
884 pstrcpy ((char *) from, (char *) cvtbuf);
885 return (char *) from;
891 /*******************************************************************
893 ********************************************************************/
894 static char *sj_to_hex(char *from, BOOL overwrite)
896 unsigned char *sp, *dp;
898 sp = (unsigned char*) from;
899 dp = (unsigned char*) cvtbuf;
900 while (*sp && (((char *)dp)- cvtbuf < sizeof(cvtbuf)-7)) {
903 *dp++ = bin2hex (((*sp)>>4)&0x0f);
904 *dp++ = bin2hex ((*sp)&0x0f);
906 } else if (is_shift_jis (*sp) && is_shift_jis2 (sp[1])) {
908 *dp++ = bin2hex (((*sp)>>4)&0x0f);
909 *dp++ = bin2hex ((*sp)&0x0f);
912 *dp++ = bin2hex (((*sp)>>4)&0x0f);
913 *dp++ = bin2hex ((*sp)&0x0f);
920 pstrcpy ((char *) from, (char *) cvtbuf);
921 return (char *) from;
927 /*******************************************************************
929 ********************************************************************/
930 /* ":xx" CAP -> a byte */
931 static char *cap_to_sj(char *from, BOOL overwrite)
937 while (*sp && (dp- cvtbuf < sizeof(cvtbuf)-2)) {
939 * The only change between this and hex_to_sj is here. sj_to_cap only
940 * translates characters greater or equal to 0x80 - make sure that here
941 * we only do the reverse (that's why the strchr is used rather than
942 * isxdigit. Based on fix from ado@elsie.nci.nih.gov (Arthur David Olson).
944 if (*sp == hex_tag && (strchr ("89abcdefABCDEF", sp[1]) != NULL) && isxdigit((int)sp[2])) {
945 *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2]));
952 pstrcpy ((char *) from, (char *) cvtbuf);
953 return (char *) from;
959 /*******************************************************************
960 kanji/kana -> ":xx" - CAP format.
961 ********************************************************************/
962 static char *sj_to_cap(char *from, BOOL overwrite)
964 unsigned char *sp, *dp;
966 sp = (unsigned char*) from;
967 dp = (unsigned char*) cvtbuf;
968 while (*sp && (((char *)dp) - cvtbuf < sizeof(cvtbuf)-4)) {
971 *dp++ = bin2hex (((*sp)>>4)&0x0f);
972 *dp++ = bin2hex ((*sp)&0x0f);
980 pstrcpy ((char *) from, (char *) cvtbuf);
981 return (char *) from;
987 /*******************************************************************
989 ********************************************************************/
990 static char *sj_to_sj(char *from, BOOL overwrite)
993 pstrcpy (cvtbuf, (char *) from);
996 return (char *) from;
1000 /************************************************************************
1002 _dos_to_unix _unix_to_dos
1003 ************************************************************************/
1005 static void setup_string_function(int codes)
1009 _dos_to_unix = dos2unix_format;
1010 _unix_to_dos = unix2dos_format;
1014 _dos_to_unix = sj_to_sj;
1015 _unix_to_dos = sj_to_sj;
1019 _dos_to_unix = sj_to_euc;
1020 _unix_to_dos = euc_to_sj;
1024 _dos_to_unix = sj_to_jis7;
1025 _unix_to_dos = jis7_to_sj;
1029 _dos_to_unix = sj_to_jis8;
1030 _unix_to_dos = jis8_to_sj;
1034 _dos_to_unix = sj_to_junet;
1035 _unix_to_dos = junet_to_sj;
1039 _dos_to_unix = sj_to_hex;
1040 _unix_to_dos = hex_to_sj;
1044 _dos_to_unix = sj_to_cap;
1045 _unix_to_dos = cap_to_sj;
1050 /************************************************************************
1051 Interpret coding system.
1052 ************************************************************************/
1054 void interpret_coding_system(char *str)
1056 int codes = UNKNOWN_CODE;
1058 if (strequal (str, "sjis")) {
1060 } else if (strequal (str, "euc")) {
1062 } else if (strequal (str, "cap")) {
1065 } else if (strequal (str, "hex")) {
1068 } else if (!strncasecmp (str, "hex", 3)) {
1070 hex_tag = (str[3] ? str[3] : HEXTAG);
1071 } else if (strequal (str, "j8bb")) {
1075 } else if (strequal (str, "j8bj") || strequal (str, "jis8")) {
1079 } else if (strequal (str, "j8bh")) {
1083 } else if (strequal (str, "j8@b")) {
1087 } else if (strequal (str, "j8@j")) {
1091 } else if (strequal (str, "j8@h")) {
1095 } else if (strequal (str, "j7bb")) {
1099 } else if (strequal (str, "j7bj") || strequal (str, "jis7")) {
1103 } else if (strequal (str, "j7bh")) {
1107 } else if (strequal (str, "j7@b")) {
1111 } else if (strequal (str, "j7@j")) {
1115 } else if (strequal (str, "j7@h")) {
1119 } else if (strequal (str, "jubb")) {
1123 } else if (strequal (str, "jubj") || strequal (str, "junet")) {
1127 } else if (strequal (str, "jubh")) {
1131 } else if (strequal (str, "ju@b")) {
1135 } else if (strequal (str, "ju@j")) {
1139 } else if (strequal (str, "ju@h")) {
1144 setup_string_function (codes);
1147 /*******************************************************************
1148 Non multibyte char function.
1149 *******************************************************************/
1151 static size_t skip_non_multibyte_char(char c)
1156 /*******************************************************************
1157 Function that always says a character isn't multibyte.
1158 *******************************************************************/
1160 static BOOL not_multibyte_char_1(char c)
1165 /*******************************************************************
1166 Function to determine if we are in a multibyte code page.
1167 *******************************************************************/
1169 static BOOL is_multibyte_codepage_val = False;
1171 BOOL is_multibyte_codepage(void)
1173 return is_multibyte_codepage_val;
1176 /*******************************************************************
1177 Setup the function pointers for the functions that are replaced
1178 when multi-byte codepages are used.
1180 The dos_to_unix and unix_to_dos function pointers are only
1181 replaced by setup_string_function called by interpret_coding_system
1183 *******************************************************************/
1185 void initialize_multibyte_vectors( int client_codepage)
1187 switch( client_codepage )
1189 case KANJI_CODEPAGE:
1190 multibyte_strchr = sj_strchr;
1191 multibyte_strrchr = sj_strrchr;
1192 multibyte_strstr = sj_strstr;
1193 multibyte_strtok = sj_strtok;
1194 _skip_multibyte_char = skip_kanji_multibyte_char;
1195 is_multibyte_char_1 = is_kanji_multibyte_char_1;
1196 is_multibyte_codepage_val = True;
1198 case HANGUL_CODEPAGE:
1199 multibyte_strchr = generic_multibyte_strchr;
1200 multibyte_strrchr = generic_multibyte_strrchr;
1201 multibyte_strstr = generic_multibyte_strstr;
1202 multibyte_strtok = generic_multibyte_strtok;
1203 _skip_multibyte_char = skip_generic_multibyte_char;
1204 is_multibyte_char_1 = hangul_is_multibyte_char_1;
1205 is_multibyte_codepage_val = True;
1208 multibyte_strchr = generic_multibyte_strchr;
1209 multibyte_strrchr = generic_multibyte_strrchr;
1210 multibyte_strstr = generic_multibyte_strstr;
1211 multibyte_strtok = generic_multibyte_strtok;
1212 _skip_multibyte_char = skip_generic_multibyte_char;
1213 is_multibyte_char_1 = big5_is_multibyte_char_1;
1214 is_multibyte_codepage_val = True;
1216 case SIMPLIFIED_CHINESE_CODEPAGE:
1217 multibyte_strchr = generic_multibyte_strchr;
1218 multibyte_strrchr = generic_multibyte_strrchr;
1219 multibyte_strstr = generic_multibyte_strstr;
1220 multibyte_strtok = generic_multibyte_strtok;
1221 _skip_multibyte_char = skip_generic_multibyte_char;
1222 is_multibyte_char_1 = simpch_is_multibyte_char_1;
1223 is_multibyte_codepage_val = True;
1226 * Single char size code page.
1229 multibyte_strchr = (const char *(*)(const char *, int )) strchr;
1230 multibyte_strrchr = (const char *(*)(const char *, int )) strrchr;
1231 multibyte_strstr = (const char *(*)(const char *, const char *)) strstr;
1232 multibyte_strtok = (char *(*)(char *, const char *)) strtok;
1233 _skip_multibyte_char = skip_non_multibyte_char;
1234 is_multibyte_char_1 = not_multibyte_char_1;
1235 is_multibyte_codepage_val = False;