#define USENMB
-#ifdef KANJI
extern int coding_system;
-#define CNV_LANG(s) (coding_system == DOSV_CODE?s:dos_to_unix(s, False))
-#define CNV_INPUT(s) (coding_system == DOSV_CODE?s:unix_to_dos(s, True))
-static BOOL
-setup_term_code (char *code)
+static BOOL setup_term_code (char *code)
{
int new;
new = interpret_coding_system (code, UNKNOWN_CODE);
}
return False;
}
-#else
#define CNV_LANG(s) dos2unix_format(s,False)
#define CNV_INPUT(s) unix2dos_format(s,True)
-#endif
/****************************************************************************
setup basics in a outgoing packet
DEBUG(0,("Usage: %s service <password> [-p port] [-d debuglevel] [-l log] ",
pname));
-#ifdef KANJI
- DEBUG(0,("[-t termcode] "));
-#endif /* KANJI */
-
DEBUG(0,("\nVersion %s\n",VERSION));
DEBUG(0,("\t-p port listen on the specified port\n"));
DEBUG(0,("\t-d debuglevel set the debuglevel\n"));
DEBUG(0,("\t-U username set the network username\n"));
DEBUG(0,("\t-W workgroup set the workgroup name\n"));
DEBUG(0,("\t-c command string execute semicolon separated commands\n"));
-#ifdef KANJI
DEBUG(0,("\t-t terminal code terminal i/o code {sjis|euc|jis7|jis8|junet|hex}\n"));
-#endif /* KANJI */
DEBUG(0,("\t-T<c|x>IXgbNa command line tar\n"));
DEBUG(0,("\t-D directory start from directory\n"));
DEBUG(0,("\n"));
BOOL message = False;
extern char tar_type;
static pstring servicesf = CONFIGFILE;
+ pstring term_code;
+
+#ifdef KANJI
+ strcpy(term_code, KANJI);
+#else /* KANJI */
+ *term_code = 0;
+#endif /* KANJI */
*query_host = 0;
*base_directory = 0;
}
}
-#ifdef KANJI
- setup_term_code (KANJI);
-#endif
while ((opt =
getopt(argc, argv,"s:B:O:M:i:Nn:d:Pp:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF)
switch (opt)
strcpy(servicesf, optarg);
break;
case 't':
-#ifdef KANJI
- if (!setup_term_code (optarg)) {
- DEBUG(0, ("%s: unknown terminal code name\n", optarg));
- usage (pname);
- exit (1);
- }
-#endif
+ strcpy(term_code, optarg);
break;
default:
usage(pname);
fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf);
}
+ codepage_initialise(lp_client_code_page());
+
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ if (!setup_term_code (term_code))
+ {
+ DEBUG(0, ("%s: unknown terminal code name\n", optarg));
+ usage (pname);
+ exit (1);
+ }
+ }
+
if (*workgroup == 0)
strcpy(workgroup,lp_workgroup());
* to lovely unix /'s :-} */
*tptr++='.';
-#ifdef KANJI
- while (l > 0) {
- if (is_shift_jis (*fp)) {
- *tptr++ = *fp++;
- *tptr++ = *fp++;
- l -= 2;
- } else if (is_kana (*fp)) {
- *tptr++ = *fp++;
- l--;
- } else if (*fp == '\\') {
- *tptr++ = '/';
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ while (l > 0) {
+ if (is_shift_jis (*fp)) {
+ *tptr++ = *fp++;
+ *tptr++ = *fp++;
+ l -= 2;
+ } else if (is_kana (*fp)) {
+ *tptr++ = *fp++;
+ l--;
+ } else if (*fp == '\\') {
+ *tptr++ = '/';
+ fp++;
+ l--;
+ } else {
+ *tptr++ = *fp++;
+ l--;
+ }
+ }
+ }
+ else
+ {
+ while (l--)
+ {
+ *tptr=(*fp == '\\') ? '/' : *fp;
+ tptr++;
fp++;
- l--;
- } else {
- *tptr++ = *fp++;
- l--;
}
}
-#else
- while (l--) { *tptr=(*fp == '\\') ? '/' : *fp; tptr++; fp++; }
-#endif
}
/****************************************************************************
if (*fp == '.') fp++;
if (*fp == '\\' || *fp == '/') fp++;
-#ifdef KANJI
- while (l > 0) {
- if (is_shift_jis (*fp)) {
- *tptr++ = *fp++;
- *tptr++ = *fp++;
- l -= 2;
- } else if (is_kana (*fp)) {
- *tptr++ = *fp++;
- l--;
- } else if (*fp == '/') {
- *tptr++ = '\\';
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ while (l > 0) {
+ if (is_shift_jis (*fp)) {
+ *tptr++ = *fp++;
+ *tptr++ = *fp++;
+ l -= 2;
+ } else if (is_kana (*fp)) {
+ *tptr++ = *fp++;
+ l--;
+ } else if (*fp == '/') {
+ *tptr++ = '\\';
+ fp++;
+ l--;
+ } else {
+ *tptr++ = *fp++;
+ l--;
+ }
+ }
+ }
+ else
+ {
+ while (l--)
+ {
+ *tptr=(*fp == '/') ? '\\' : *fp;
+ tptr++;
fp++;
- l--;
- } else {
- *tptr++ = *fp++;
- l--;
}
}
-#else
- while (l--) { *tptr=(*fp == '/') ? '\\' : *fp; tptr++; fp++; }
-#endif
}
static void do_tarput()
#ifndef _KANJI_H_
#define _KANJI_H_
-#ifdef KANJI
-
/* FOR SHIFT JIS CODE */
#define is_shift_jis(c) \
((0x81 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0x9f) \
extern char* (*_dos_to_unix) (const char *str, BOOL overwrite);
extern char* (*_unix_to_dos) (const char *str, BOOL overwrite);
-#define unix_to_dos (*_unix_to_dos)
-#define dos_to_unix (*_dos_to_unix)
-
extern char *sj_strtok (char *s1, const char *s2);
extern char *sj_strchr (const char *s, int c);
extern char *sj_strrchr (const char *s, int c);
int interpret_coding_system (char *str, int def);
-#else
-
#define unix_to_dos(x,y) unix2dos_format(x,y)
#define dos_to_unix(x,y) dos2unix_format(x,y)
-#endif /* not KANJI */
-
#endif /* _KANJI_H_ */
#endif
+/* Defines needed for multi-codepage support. */
+#define KANJI_CODEPAGE 932
+
#ifdef KANJI
-/* Default client code page - 932 - Japanese */
-#define DEFAULT_CLIENT_CODE_PAGE 932
+/* Default client code page - Japanese */
+#define DEFAULT_CLIENT_CODE_PAGE KANJI_CODEPAGE
#else /* KANJI */
/* Default client code page - 850 - Western European */
#define DEFAULT_CLIENT_CODE_PAGE 850
#endif /* KANJI */
-
/* Size of buffer to use when moving files across filesystems. */
#define COPYBUF_SIZE (8*1024)
char *dp;
if (!mapsinited) initmaps();
- if (overwrite) {
- for (p = str; *p; p++) *p = unix2dos[(unsigned char)*p];
- return str;
- } else {
- for (p = str, dp = cvtbuf; *p; p++,dp++) *dp = unix2dos[(unsigned char)*p];
- *dp = 0;
- return cvtbuf;
+
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ return (*_unix_to_dos)(str, overwrite);
+ else {
+ if (overwrite) {
+ for (p = str; *p; p++) *p = unix2dos[(unsigned char)*p];
+ return str;
+ } else {
+ for (p = str, dp = cvtbuf; *p; p++,dp++) *dp = unix2dos[(unsigned char)*p];
+ *dp = 0;
+ return cvtbuf;
+ }
}
}
char *dp;
if (!mapsinited) initmaps();
- if (overwrite) {
- for (p = str; *p; p++) *p = dos2unix[(unsigned char)*p];
- return str;
- } else {
- for (p = str, dp = cvtbuf; *p; p++,dp++) *dp = dos2unix[(unsigned char)*p];
- *dp = 0;
- return cvtbuf;
+
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ return (*_dos_to_unix)(str, overwrite);
+ else {
+ if (overwrite) {
+ for (p = str; *p; p++) *p = dos2unix[(unsigned char)*p];
+ return str;
+ } else {
+ for (p = str, dp = cvtbuf; *p; p++,dp++) *dp = dos2unix[(unsigned char)*p];
+ *dp = 0;
+ return cvtbuf;
+ }
}
}
and add all jis codes sequence type at 1995.8.16
Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
*/
-#ifdef KANJI
#define _KANJI_C_
#include "includes.h"
}
return setup_string_function (codes);
}
-#else
- int kanji_dummy_procedure(void)
-{return 0;}
-#endif /* KANJI */
/* We *must* use toupper rather than tolower here due to the
asynchronous upper to lower mapping.
*/
-#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
- /* Win95 treats full width ascii characters as case sensitive. */
- int diff;
- for (;;)
+#if !defined(KANJI_WIN95_COMPATIBILITY)
+ if(lp_client_code_page() == KANJI_CODEPAGE)
{
- if (!*s || !*t)
- return toupper (*s) - toupper (*t);
- else if (is_sj_alph (*s) && is_sj_alph (*t))
- {
- diff = sj_toupper2 (*(s+1)) - sj_toupper2 (*(t+1));
- if (diff)
- return diff;
- s += 2;
- t += 2;
- }
- else if (is_shift_jis (*s) && is_shift_jis (*t))
- {
- diff = ((int) (unsigned char) *s) - ((int) (unsigned char) *t);
- if (diff)
- return diff;
- diff = ((int) (unsigned char) *(s+1)) - ((int) (unsigned char) *(t+1));
- if (diff)
- return diff;
- s += 2;
- t += 2;
- }
- else if (is_shift_jis (*s))
- return 1;
- else if (is_shift_jis (*t))
- return -1;
- else
- {
- diff = toupper (*s) - toupper (*t);
- if (diff)
- return diff;
- s++;
- t++;
- }
+ /* Win95 treats full width ascii characters as case sensitive. */
+ int diff;
+ for (;;)
+ {
+ if (!*s || !*t)
+ return toupper (*s) - toupper (*t);
+ else if (is_sj_alph (*s) && is_sj_alph (*t))
+ {
+ diff = sj_toupper2 (*(s+1)) - sj_toupper2 (*(t+1));
+ if (diff)
+ return diff;
+ s += 2;
+ t += 2;
+ }
+ else if (is_shift_jis (*s) && is_shift_jis (*t))
+ {
+ diff = ((int) (unsigned char) *s) - ((int) (unsigned char) *t);
+ if (diff)
+ return diff;
+ diff = ((int) (unsigned char) *(s+1)) - ((int) (unsigned char) *(t+1));
+ if (diff)
+ return diff;
+ s += 2;
+ t += 2;
+ }
+ else if (is_shift_jis (*s))
+ return 1;
+ else if (is_shift_jis (*t))
+ return -1;
+ else
+ {
+ diff = toupper (*s) - toupper (*t);
+ if (diff)
+ return diff;
+ s++;
+ t++;
+ }
+ }
}
-#else /* KANJI */
- while (*s && *t && toupper(*s) == toupper(*t))
+ else
+#endif /* KANJI_WIN95_COMPATIBILITY */
{
- s++; t++;
- }
+ while (*s && *t && toupper(*s) == toupper(*t))
+ {
+ s++;
+ t++;
+ }
- return(toupper(*s) - toupper(*t));
-#endif /* KANJI */
+ return(toupper(*s) - toupper(*t));
+ }
}
/*******************************************************************
/* We *must* use toupper rather than tolower here due to the
asynchronous upper to lower mapping.
*/
-#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
- /* Win95 treats full width ascii characters as case sensitive. */
- int diff;
- for (;n > 0;)
+#if !defined(KANJI_WIN95_COMPATIBILITY)
+ if(lp_client_code_page() == KANJI_CODEPAGE)
{
- if (!*s || !*t)
- return toupper (*s) - toupper (*t);
- else if (is_sj_alph (*s) && is_sj_alph (*t))
- {
- diff = sj_toupper2 (*(s+1)) - sj_toupper2 (*(t+1));
- if (diff)
- return diff;
- s += 2;
- t += 2;
- n -= 2;
- }
- else if (is_shift_jis (*s) && is_shift_jis (*t))
- {
- diff = ((int) (unsigned char) *s) - ((int) (unsigned char) *t);
- if (diff)
- return diff;
- diff = ((int) (unsigned char) *(s+1)) - ((int) (unsigned char) *(t+1));
- if (diff)
- return diff;
- s += 2;
- t += 2;
- n -= 2;
- }
- else if (is_shift_jis (*s))
- return 1;
- else if (is_shift_jis (*t))
- return -1;
- else
- {
- diff = toupper (*s) - toupper (*t);
- if (diff)
- return diff;
- s++;
- t++;
- n--;
- }
+ /* Win95 treats full width ascii characters as case sensitive. */
+ int diff;
+ for (;n > 0;)
+ {
+ if (!*s || !*t)
+ return toupper (*s) - toupper (*t);
+ else if (is_sj_alph (*s) && is_sj_alph (*t))
+ {
+ diff = sj_toupper2 (*(s+1)) - sj_toupper2 (*(t+1));
+ if (diff)
+ return diff;
+ s += 2;
+ t += 2;
+ n -= 2;
+ }
+ else if (is_shift_jis (*s) && is_shift_jis (*t))
+ {
+ diff = ((int) (unsigned char) *s) - ((int) (unsigned char) *t);
+ if (diff)
+ return diff;
+ diff = ((int) (unsigned char) *(s+1)) - ((int) (unsigned char) *(t+1));
+ if (diff)
+ return diff;
+ s += 2;
+ t += 2;
+ n -= 2;
+ }
+ else if (is_shift_jis (*s))
+ return 1;
+ else if (is_shift_jis (*t))
+ return -1;
+ else
+ {
+ diff = toupper (*s) - toupper (*t);
+ if (diff)
+ return diff;
+ s++;
+ t++;
+ n--;
+ }
+ }
+ return 0;
}
- return 0;
-#else /* KANJI */
- while (n-- && *s && *t && toupper(*s) == toupper(*t))
+ else
+#endif /* KANJI_WIN95_COMPATIBILITY */
{
- s++; t++;
- }
+ while (n-- && *s && *t && toupper(*s) == toupper(*t))
+ {
+ s++;
+ t++;
+ }
- /* not run out of chars - strings are different lengths */
- if (n) return(toupper(*s) - toupper(*t));
+ /* not run out of chars - strings are different lengths */
+ if (n)
+ return(toupper(*s) - toupper(*t));
- /* identical up to where we run out of chars, and strings are same length */
- return(0);
-#endif /* KANJI */
+ /* identical up to where we run out of chars,
+ and strings are same length */
+ return(0);
+ }
}
/*******************************************************************
void strlower(char *s)
{
while (*s)
+ {
+#if !defined(KANJI_WIN95_COMPATIBILITY)
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ /* Win95 treats full width ascii characters as case sensitive. */
+ if (is_shift_jis (*s))
+ {
+ if (is_sj_upper (s[0], s[1]))
+ s[1] = sj_tolower2 (s[1]);
+ s += 2;
+ }
+ else if (is_kana (*s))
+ {
+ s++;
+ }
+ else
+ {
+ if (isupper(*s))
+ *s = tolower(*s);
+ s++;
+ }
+ }
+ else
+#endif /* KANJI_WIN95_COMPATIBILITY */
{
-#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
- /* Win95 treats full width ascii characters as case sensitive. */
- if (is_shift_jis (*s)) {
- if (is_sj_upper (s[0], s[1])) {
- s[1] = sj_tolower2 (s[1]);
- }
- s += 2;
- } else if (is_kana (*s)) {
- s++;
- } else {
- if (isupper(*s))
- *s = tolower(*s);
- s++;
- }
-#else /* KANJI */
if (isupper(*s))
- *s = tolower(*s);
+ *s = tolower(*s);
s++;
-#endif /* KANJI */
}
+ }
}
/*******************************************************************
void strupper(char *s)
{
while (*s)
+ {
+#if !defined(KANJI_WIN95_COMPATIBILITY)
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ /* Win95 treats full width ascii characters as case sensitive. */
+ if (is_shift_jis (*s))
+ {
+ if (is_sj_lower (s[0], s[1]))
+ s[1] = sj_toupper2 (s[1]);
+ s += 2;
+ }
+ else if (is_kana (*s))
+ {
+ s++;
+ }
+ else
+ {
+ if (islower(*s))
+ *s = toupper(*s);
+ s++;
+ }
+ }
+ else
+#endif /* KANJI_WIN95_COMPATIBILITY */
{
-#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
- /* Win95 treats full width ascii characters as case sensitive. */
- if (is_shift_jis (*s)) {
- if (is_sj_lower (s[0], s[1])) {
- s[1] = sj_toupper2 (s[1]);
- }
- s += 2;
- } else if (is_kana (*s)) {
- s++;
- } else {
- if (islower(*s))
- *s = toupper(*s);
- s++;
- }
-#else /* KANJI */
if (islower(*s))
- *s = toupper(*s);
+ *s = toupper(*s);
s++;
-#endif /* KANJI */
}
+ }
}
/*******************************************************************
void string_replace(char *s,char oldc,char newc)
{
while (*s)
+ {
+#if !defined(KANJI_WIN95_COMPATIBILITY)
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ /* Win95 treats full width ascii characters as case sensitive. */
+ if (is_shift_jis (*s))
+ s += 2;
+ else if (is_kana (*s))
+ s++;
+ else
+ {
+ if (oldc == *s)
+ *s = newc;
+ s++;
+ }
+ }
+ else
+#endif /* KANJI_WIN95_COMPATIBILITY */
{
-#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
- /* Win95 treats full width ascii characters as case sensitive. */
- if (is_shift_jis (*s)) {
- s += 2;
- } else if (is_kana (*s)) {
- s++;
- } else {
- if (oldc == *s)
- *s = newc;
- s++;
- }
-#else /* KANJI */
if (oldc == *s)
- *s = newc;
+ *s = newc;
s++;
-#endif /* KANJI */
}
+ }
}
/****************************************************************************
BOOL strhasupper(char *s)
{
while (*s)
+ {
+#if !defined(KANJI_WIN95_COMPATIBILITY)
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ /* Win95 treats full width ascii characters as case sensitive. */
+ if (is_shift_jis (*s))
+ s += 2;
+ else if (is_kana (*s))
+ s++;
+ else
+ {
+ if (isupper(*s))
+ return(True);
+ s++;
+ }
+ }
+ else
+#endif /* KANJI_WIN95_COMPATIBILITY */
{
-#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
- /* Win95 treats full width ascii characters as case sensitive. */
- if (is_shift_jis (*s)) {
- s += 2;
- } else if (is_kana (*s)) {
- s++;
- } else {
- if (isupper(*s)) return(True);
- s++;
- }
-#else /* KANJI */
- if (isupper(*s)) return(True);
+ if (isupper(*s))
+ return(True);
s++;
-#endif /* KANJI */
}
+ }
return(False);
}
BOOL strhaslower(char *s)
{
while (*s)
+ {
+#if !defined(KANJI_WIN95_COMPATIBILITY)
+ if(lp_client_code_page() == KANJI_CODEPAGE)
{
-#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
- /* Win95 treats full width ascii characters as case sensitive. */
- if (is_shift_jis (*s)) {
- if (is_sj_upper (s[0], s[1])) return(True);
- if (is_sj_lower (s[0], s[1])) return (True);
- s += 2;
- } else if (is_kana (*s)) {
- s++;
- } else {
- if (islower(*s)) return(True);
- s++;
- }
-#else /* KANJI */
- if (islower(*s)) return(True);
+ /* Win95 treats full width ascii characters as case sensitive. */
+ if (is_shift_jis (*s))
+ {
+ if (is_sj_upper (s[0], s[1]))
+ return(True);
+ if (is_sj_lower (s[0], s[1]))
+ return (True);
+ s += 2;
+ }
+ else if (is_kana (*s))
+ {
+ s++;
+ }
+ else
+ {
+ if (islower(*s))
+ return(True);
+ s++;
+ }
+ }
+ else
+#endif /* KANJI_WIN95_COMPATIBILITY */
+ {
+ if (islower(*s))
+ return(True);
s++;
-#endif /* KANJI */
}
+ }
return(False);
}
int count_chars(char *s,char c)
{
int count=0;
-#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
- /* Win95 treats full width ascii characters as case sensitive. */
- while (*s)
+
+#if !defined(KANJI_WIN95_COMPATIBILITY)
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ /* Win95 treats full width ascii characters as case sensitive. */
+ while (*s)
{
- if (is_shift_jis (*s))
- s += 2;
- else
- {
- if (*s == c)
- count++;
- s++;
+ if (is_shift_jis (*s))
+ s += 2;
+ else
+ {
+ if (*s == c)
+ count++;
+ s++;
+ }
}
}
-#else /* KANJI */
- while (*s)
+ else
+#endif /* KANJI_WIN95_COMPATIBILITY */
+ {
+ while (*s)
{
if (*s == c)
- count++;
+ count++;
s++;
}
-#endif /* KANJI */
+ }
return(count);
}
#ifdef SECURE_SHARE_MODES
fd = (share_lock_token)open(fname,O_RDWR|O_CREAT,0600);
#else /* SECURE_SHARE_MODES */
- fd = (share_lock_token)open(fname,O_RDWR|O_CREAT,0644);
+ fd = (share_lock_token)open(fname,O_RDWR|O_CREAT,0666);
#endif /* SECURE_SHARE_MODES */
umask(old_umask);
if(!become_user(cnum,Connections[cnum].vuid))
p = *p1;
- if (recursion_available && lp_wins_server())
- {
- DEBUG(0,("reply_netbios_packet: r_a not to be used when not a WINS server\n"));
- }
-
switch (rcv_code)
{
case NMB_STATUS:
#include "includes.h"
+/* Set default coding system for KANJI if none specified in Makefile. */
+#ifndef KANJI
+#define KANJI "sjis"
+#endif /* KANJI */
+
BOOL bLoaded = False;
extern int DEBUGLEVEL;
extern BOOL use_getwd_cache;
extern int extra_time_offset;
-#ifdef KANJI
extern int coding_system;
-#endif
/*
* This structure describes global (ie., server-wide) parameters.
static BOOL handle_printing(char *pszParmValue,int *val);
static BOOL handle_character_set(char *pszParmValue,int *val);
static BOOL handle_announce_as(char *pszParmValue, int *val);
-#ifdef KANJI
static BOOL handle_coding_system(char *pszParmValue,int *val);
-#endif /* KANJI */
static void set_default_server_announce_type(void);
{"read size", P_INTEGER, P_GLOBAL, &Globals.ReadSize, NULL},
{"shared mem size", P_INTEGER, P_GLOBAL, &Globals.shmem_size, NULL},
{"shared file entries", P_INTEGER, P_GLOBAL, &Globals.shmem_hash_size, NULL},
-#ifdef KANJI
{"coding system", P_INTEGER, P_GLOBAL, &coding_system, handle_coding_system},
-#endif /* KANJI */
{"client code page", P_INTEGER, P_GLOBAL, &Globals.client_code_page, NULL},
{"os level", P_INTEGER, P_GLOBAL, &Globals.os_level, NULL},
{"max ttl", P_INTEGER, P_GLOBAL, &Globals.max_ttl, NULL},
Globals.bNISHomeMap = False;
string_set(&Globals.szNISHomeMapName, "auto.home");
#endif
-#ifdef KANJI
coding_system = interpret_coding_system (KANJI, SJIS_CODE);
-#endif /* KANJI */
Globals.client_code_page = DEFAULT_CLIENT_CODE_PAGE;
Globals.bTimeServer = False;
return(False);
}
-#ifdef KANJI
/***************************************************************************
handle the interpretation of the coding system parameter
*************************************************************************/
*val = interpret_coding_system(pszParmValue,*val);
return(True);
}
-#endif /* KANJI */
/***************************************************************************
handle the interpretation of the character set system parameter
{
char *p = fname;
-#ifdef KANJI
- dot_pos = 0;
- while (*p)
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ dot_pos = 0;
+ while (*p)
{
- if (is_shift_jis (*p)) {
- p += 2;
- } else if (is_kana (*p)) {
- p ++;
- } else {
- if (*p == '.' && !dot_pos)
- dot_pos = (char *) p;
- if (!isdoschar(*p))
- return(False);
- p++;
- }
- }
-#else
- while (*p)
+ if (is_shift_jis (*p))
+ p += 2;
+ else if (is_kana (*p))
+ p ++;
+ else
+ {
+ if (*p == '.' && !dot_pos)
+ dot_pos = (char *) p;
+ if (!isdoschar(*p))
+ return(False);
+ p++;
+ }
+ }
+ }
+ else
+ {
+ while (*p)
{
- if (!isdoschar(*p))
- return(False);
- p++;
+ if (!isdoschar(*p))
+ return(False);
+ p++;
}
-#endif /* KANJI */
+ }
}
/* no dot and less than 9 means OK */
DEBUG(5,("Mangling name %s to ",s));
if (p)
- {
- if (p == s)
- strcpy(extension,"___");
- else
+ {
+ if (p == s)
+ strcpy(extension,"___");
+ else
{
*p++ = 0;
while (*p && extlen < 3)
- {
-#ifdef KANJI
- if (is_shift_jis (*p))
- {
- if (extlen < 2)
- {
- extension[extlen++] = p[0];
- extension[extlen++] = p[1];
- }
- else
- {
- extension[extlen++] = base36 (((unsigned char) *p) % 36);
- }
- p += 2;
- }
- else if (is_kana (*p))
- {
- extension[extlen++] = p[0];
- p++;
- }
- else
- {
- if (isdoschar (*p) && *p != '.')
- extension[extlen++] = p[0];
- p++;
- }
-#else
- if (isdoschar(*p) && *p != '.')
- extension[extlen++] = *p;
- p++;
-#endif /* KANJI */
- }
+ {
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ if (is_shift_jis (*p))
+ {
+ if (extlen < 2)
+ {
+ extension[extlen++] = p[0];
+ extension[extlen++] = p[1];
+ }
+ else
+ {
+ extension[extlen++] = base36 (((unsigned char) *p) % 36);
+ }
+ p += 2;
+ }
+ else if (is_kana (*p))
+ {
+ extension[extlen++] = p[0];
+ p++;
+ }
+ else
+ {
+ if (isdoschar (*p) && *p != '.')
+ extension[extlen++] = p[0];
+ p++;
+ }
+ }
+ else
+ {
+ if (isdoschar(*p) && *p != '.')
+ extension[extlen++] = *p;
+ p++;
+ }
+ }
extension[extlen] = 0;
- }
}
+ }
p = s;
while (*p && baselen < 5)
+ {
+ if(lp_client_code_page() == KANJI_CODEPAGE)
{
-#ifdef KANJI
if (is_shift_jis (*p))
- {
- if (baselen < 4)
- {
- base[baselen++] = p[0];
- base[baselen++] = p[1];
- }
- else
- {
+ {
+ if (baselen < 4)
+ {
+ base[baselen++] = p[0];
+ base[baselen++] = p[1];
+ }
+ else
+ {
base[baselen++] = base36 (((unsigned char) *p) % 36);
- }
- p += 2;
- }
+ }
+ p += 2;
+ }
else if (is_kana (*p))
- {
- base[baselen++] = p[0];
- p++;
- }
+ {
+ base[baselen++] = p[0];
+ p++;
+ }
else
- {
- if (isdoschar (*p) && *p != '.')
- base[baselen++] = p[0];
- p++;
- }
-#else
+ {
+ if (isdoschar (*p) && *p != '.')
+ base[baselen++] = p[0];
+ p++;
+ }
+ }
+ else
+ {
if (isdoschar(*p) && *p != '.')
- base[baselen++] = *p;
+ base[baselen++] = *p;
p++;
-#endif /* KANJI */
}
+ }
base[baselen] = 0;
csum = csum % (36*36);
static BOOL initialised=False;
unsigned char *s;
- if (!initialised) {
+ if (!initialised)
+ {
char *ill = "*\\/?<>|\":{}";
initialised = True;
illegal[*s] = True;
}
-#ifdef KANJI
- for (s = (unsigned char *)name; *s;) {
- if (is_shift_jis (*s)) {
- s += 2;
- } else if (illegal[*s]) {
- return(True);
- } else {
- s++;
+ if(lp_client_code_page() == KANJI_CODEPAGE)
+ {
+ for (s = (unsigned char *)name; *s;) {
+ if (is_shift_jis (*s)) {
+ s += 2;
+ } else if (illegal[*s]) {
+ return(True);
+ } else {
+ s++;
+ }
}
}
-#else
- for (s = (unsigned char *)name;*s;s++)
- if (illegal[*s]) return(True);
-#endif
-
+ else
+ {
+ for (s = (unsigned char *)name;*s;s++)
+ if (illegal[*s]) return(True);
+ }
return(False);
}
tvs.modtime=MAX(interpret_long_date(pdata+16),
interpret_long_date(pdata+24));
+#if 0 /* Needs more testing... */
+ /* Test from Luke to prevent Win95 from
+ setting incorrect values here.
+ */
+ if (tvs.actime < tvs.modtime)
+ return(ERROR(ERRDOS,ERRnoaccess));
+#endif /* Needs more testing... */
+
/* attributes */
mode = IVAL(pdata,32);
break;
retries = 1;
}
- if (name_query(ServerFD,lookup,lookup_type,bcast,True,
+ if (name_query(ServerFD,lookup,lookup_type,bcast,True,
bcast_addr,&ip,NULL))
- {
- printf("%s %s\n",inet_ntoa(ip),lookup);
- }
+ {
+ printf("%s %s\n",inet_ntoa(ip),lookup);
+
+ /* We can only do find_status if the ip address returned
+ was valid - ie. name_query returned true.
+ */
if (find_status)
{
printf("Looking up status of %s\n",inet_ntoa(ip));
name_status(ServerFD,lookup,lookup_type,True,ip,NULL,NULL,NULL);
printf("\n");
}
+ }
+ else
+ {
+ printf("name_query failed to find name %s\n", lookup);
+ }
}
return(0);