From 5546e28e69b1a43dbb48e024e233d8ebf7fa667a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 7 Feb 1998 12:15:20 +0000 Subject: A small raft of changes, I will sync up with 1.9.18 also. chgpasswd.c: Fixed typo in debug message. includes.h: Fix include for aix. kanji.c: Added cap_to_sj as inverse of sj_to_cap. loadparm.c: local.h: password.c: Added code for "networkstation user login" parameter. - patch from Rob Nielsen . printing.c: Added further aix printing fixes. reply.c: Changed access time fetch to a function. trans2.c: Changed access time fetch to a function. time.c: Changed access time fetch to a function. server.c: Made NT redirector workaround final. util.c: Added debug for write_socket failing. Jeremy. (This used to be commit a031404623c22d62f8de035be2239f609af08112) --- source3/lib/kanji.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'source3/lib/kanji.c') diff --git a/source3/lib/kanji.c b/source3/lib/kanji.c index 2027a344c2..d63798914e 100644 --- a/source3/lib/kanji.c +++ b/source3/lib/kanji.c @@ -693,7 +693,39 @@ static char *sj_to_hex(char *from, BOOL overwrite) } /******************************************************************* - kanji/kana -> ":xx" + CAP <-> SJIS +********************************************************************/ +/* ":xx" CAP -> a byte */ +static char *cap_to_sj(char *from, BOOL overwrite) +{ + char *sp, *dp; + + sp = (char *) from; + dp = cvtbuf; + while (*sp) { + /* + * The only change between this and hex_to_sj is here. sj_to_cap only + * translates characters greater or equal to 0x80 - make sure that here + * we only do the reverse (that's why the strchr is used rather than + * isxdigit. Based on fix from ado@elsie.nci.nih.gov (Arthur David Olson). + */ + if (*sp == hex_tag && (strchr ("89abcdefABCDEF", sp[1]) != NULL) && isxdigit (sp[2])) { + *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2])); + sp += 3; + } else + *dp++ = *sp++; + } + *dp = '\0'; + if (overwrite) { + strcpy ((char *) from, (char *) cvtbuf); + return (char *) from; + } else { + return cvtbuf; + } +} + +/******************************************************************* + kanji/kana -> ":xx" - CAP format. ********************************************************************/ static char *sj_to_cap(char *from, BOOL overwrite) { @@ -778,7 +810,7 @@ static int setup_string_function(int codes) case CAP_CODE: _dos_to_unix = sj_to_cap; - _unix_to_dos = hex_to_sj; + _unix_to_dos = cap_to_sj; break; } return codes; -- cgit