From bce14d3642ca510c2237d3b39da47099207752c8 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Thu, 21 Aug 1997 20:03:45 +0000 Subject: Kanji fixes for upper/lower case conversion with sjis characters. Code from Takashi Fujita . Jeremy (jallison@whistle.com) (This used to be commit 07f7e378c4839d0ca4bb79c8755481f4bf5637de) --- source3/include/kanji.h | 17 +++++++++++++++++ source3/include/proto.h | 1 + 2 files changed, 18 insertions(+) (limited to 'source3/include') diff --git a/source3/include/kanji.h b/source3/include/kanji.h index ee3ba7e09a..865ac3b2c9 100644 --- a/source3/include/kanji.h +++ b/source3/include/kanji.h @@ -22,6 +22,7 @@ and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11 and add all jis codes sequence at 1995.8.16 Notes: Hexadecimal code by + and add upper/lower case conversion 1997.8.21 */ #ifndef _KANJI_H_ #define _KANJI_H_ @@ -37,6 +38,22 @@ && ((unsigned char) (c)) != 0x7f) #define is_kana(c) ((0xa0 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xdf)) +/* case conversion */ +#define is_sj_upper2(c) \ + ((0x60 <= (unsigned char) (c)) && ((unsigned char) (c) <= 0x79)) +#define is_sj_lower2(c) \ + ((0x81 <= (unsigned char) (c)) && ((unsigned char) (c) <= 0x9A)) +#define sjis_alph 0x82 +#define is_sj_alph(c) (sjis_alph == (unsigned char) (c)) +#define is_sj_upper(c1, c2) (is_sj_alph (c1) && is_sj_upper2 (c2)) +#define is_sj_lower(c1, c2) (is_sj_alph (c1) && is_sj_lower2 (c2)) +#define sj_toupper2(c) \ + (is_sj_lower2 (c) ? ((int) ((unsigned char) (c) - 0x81 + 0x60)) : \ + ((int) (unsigned char) (c))) +#define sj_tolower2(c) \ + (is_sj_upper2 (c) ? ((int) ((unsigned char) (c) - 0x60 + 0x81)) : \ + ((int) (unsigned char) (c))) + #ifdef _KANJI_C_ /* FOR EUC CODE */ #define euc_kana (0x8e) diff --git a/source3/include/proto.h b/source3/include/proto.h index f716c1f9a9..9f05e5bbff 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -794,6 +794,7 @@ int sys_chdir(char *dname); int sys_utime(char *fname,struct utimbuf *times); int sys_rename(char *from, char *to); int sys_chmod(char *fname,int mode); +char *sys_getwd(char *s); int sys_chown(char *fname,int uid,int gid); int sys_chroot(char *dname); struct hostent *sys_gethostbyname(char *name); -- cgit