summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-03-03 20:19:14 +0000
committerJeremy Allison <jra@samba.org>1998-03-03 20:19:14 +0000
commitb7fb6c6b38784d25c9c85e9b27b08e30111dbd0c (patch)
treeff98efd1c5b4f92782b9687791a321037e2f9e6d /source3/include
parentf0e121d100ef207b683fbb8d3079403e22929d0a (diff)
downloadsamba-b7fb6c6b38784d25c9c85e9b27b08e30111dbd0c.tar.gz
samba-b7fb6c6b38784d25c9c85e9b27b08e30111dbd0c.tar.bz2
samba-b7fb6c6b38784d25c9c85e9b27b08e30111dbd0c.zip
Change the multibyte character set support so that
Kanji support is one case of multibyte character support, rather than being a specific case in single byte character support. This allows us to add Big5 Chinese support (code page 950) and Korean Hangul support (code page 949) at very little cost. Also allows us to easily add future multibyte code pages. Makefile: Added codepages 949, 950 as we now support more multibyte codepages. asyncdns.c: Fixed problem with child being re-spawned when parent killed. charcnv.c charset.c client.c clitar.c kanji.c kanji.h smb.h util.c loadparm.c: Generic multibyte codepage support (adding Big5 Chinese and Korean Hangul). nmbd.c: Fixed problem with child being re-spawned when parent killed. mangle.c: Modified str_checksum so that first 15 characters have more effect on outcome. This helps with short name mangling as most 'long' names are still shorter than 15 chars (bug was foobar_mng and foobar_sum would hash to the same value, with the modified code they hash differently. Jeremy. (This used to be commit 299016338cfb47f0c585875ef9b468121fcee97d)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/kanji.h34
-rw-r--r--source3/include/proto.h9
-rw-r--r--source3/include/smb.h5
3 files changed, 31 insertions, 17 deletions
diff --git a/source3/include/kanji.h b/source3/include/kanji.h
index 101b98cfa3..302db13a27 100644
--- a/source3/include/kanji.h
+++ b/source3/include/kanji.h
@@ -103,10 +103,13 @@
#define bin2hex(x) \
( (((int) (x)) >= 10)? (((int) (x))-10 + (int) 'a'): (((int) (x)) + (int) '0') )
-#else /* not _KANJI_C_ */
+/* For Hangul (Korean - code page 949). */
+#define is_hangul(c) ((0x81 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xfd))
-extern char *(*_dos_to_unix)(char *str, BOOL overwrite);
-extern char *(*_unix_to_dos)(char *str, BOOL overwrite);
+/* For traditional Chinese (known as Big5 encoding - code page 950). */
+#define is_big5_c1(c) ((0xa1 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xf9))
+
+#else /* not _KANJI_C_ */
/*
* The following is needed for AIX systems that have
@@ -130,12 +133,24 @@ extern char *(*_unix_to_dos)(char *str, BOOL overwrite);
#undef strtok
#endif /* strtok */
-/* Ensure we use our definitions. */
+/* Ensure we use our definitions in all other files than kanji.c. */
-#define strchr sj_strchr
-#define strrchr sj_strrchr
-#define strstr sj_strstr
-#define strtok sj_strtok
+/* Function pointers we will replace. */
+extern char *(*multibyte_strchr)(char *s, int c);
+extern char *(*multibyte_strrchr)(char *s, int c);
+extern char *(*multibyte_strstr)(char *s1, char *s2);
+extern char *(*multibyte_strtok)(char *s1, char *s2);
+extern char *(*_dos_to_unix)(char *str, BOOL overwrite);
+extern char *(*_unix_to_dos)(char *str, BOOL overwrite);
+extern BOOL (*is_multibyte_char)(char c);
+
+#define strchr(s1, c) ((*multibyte_strchr)((s1), (c)))
+#define strrchr(s1, c) ((*multibyte_strrchr)((s1), (c)))
+#define strstr(s1, s2) ((*multibyte_strstr)((s1), (s2)))
+#define strtok(s1, s2) ((*multibyte_strtok)((s1), (s2)))
+#define dos_to_unix(x,y) ((*_dos_to_unix)((x), (y)))
+#define unix_to_dos(x,y) ((*_unix_to_dos)((x), (y)))
+#define skip_multibyte_char(c) ((*is_multibyte_char)((c)))
#endif /* _KANJI_C_ */
@@ -149,7 +164,4 @@ extern char *(*_unix_to_dos)(char *str, BOOL overwrite);
#define CAP_CODE (6)
#define DOSV_CODE SJIS_CODE
-#define unix_to_dos(x,y) unix2dos_format(x,y)
-#define dos_to_unix(x,y) dos2unix_format(x,y)
-
#endif /* _KANJI_H_ */
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 802d9973df..47ef5812ca 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -9,12 +9,14 @@ BOOL allow_access(char *deny_list,char *allow_list,char *cname,char *caddr);
/*The following definitions come from asyncdns.c */
int asyncdns_fd(void);
+void kill_async_dns_child();
void start_async_dns(void);
void run_dns_queue(void);
BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
struct name_record **n);
BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
struct name_record **n);
+void kill_async_dns_child();
/*The following definitions come from cgi.c */
@@ -206,11 +208,8 @@ int reply_trans(char *inbuf,char *outbuf, int size, int bufsize);
/*The following definitions come from kanji.c */
-char *sj_strtok(char *s1, char *s2);
-char *sj_strstr(char *s1, char *s2);
-char *sj_strchr (char *s, int c);
-char *sj_strrchr(char *s, int c);
-int interpret_coding_system(char *str);
+void interpret_coding_system(char *str);
+void initialize_multibyte_vectors( int client_codepage);
/*The following definitions come from loadparm.c */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 77f4006c4a..f7a134d797 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -2099,7 +2099,10 @@ enum case_handling {CASE_LOWER,CASE_UPPER};
#endif
/* Defines needed for multi-codepage support. */
+#define MSDOS_LATIN_1_CODEPAGE 850
#define KANJI_CODEPAGE 932
+#define HANGUL_CODEPAGE 949
+#define BIG5_CODEPAGE 950
#ifdef KANJI
/*
@@ -2110,7 +2113,7 @@ enum case_handling {CASE_LOWER,CASE_UPPER};
/*
* Default client code page - 850 - Western European
*/
-#define DEFAULT_CLIENT_CODE_PAGE 850
+#define DEFAULT_CLIENT_CODE_PAGE MSDOS_LATIN_1_CODEPAGE
#endif /* KANJI */
/*