summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1997-09-11 20:17:32 +0000
committerJeremy Allison <jra@samba.org>1997-09-11 20:17:32 +0000
commit30416c0b8a0f54f6cc1179c2e00860eaf5f58401 (patch)
tree09137fd9f782aaf0df42e59aff10953ed95bed32 /source3/client
parent77df5c87c69ea7f929df211c41da522248d73cfc (diff)
downloadsamba-30416c0b8a0f54f6cc1179c2e00860eaf5f58401.tar.gz
samba-30416c0b8a0f54f6cc1179c2e00860eaf5f58401.tar.bz2
samba-30416c0b8a0f54f6cc1179c2e00860eaf5f58401.zip
charcnv.c client.c clitar.c kanji.c kanji.h loadparm.c
mangle.c smb.h util.c: Big merge to allow KANJI support to be in the main binary without explicitly compiling with it. locking.c: Fix for smbstatus not being able to read files. namepacket.c: Removed unneccesary debug statement. trans2.c: Added Luke's proposed fix (ifdefed out until further testing). nmblookup.c: Fixed bug where query fails and status is done on bogus IP. Jeremy (jallison@whistle.com) (This used to be commit 9196255022ae8c51b527412747b324819bea2c13)
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c44
-rw-r--r--source3/client/clitar.c88
2 files changed, 73 insertions, 59 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 4718db84ac..e9042555e2 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -143,12 +143,8 @@ extern int Client;
#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);
@@ -158,10 +154,8 @@ setup_term_code (char *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
@@ -4392,10 +4386,6 @@ static void usage(char *pname)
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"));
@@ -4411,9 +4401,7 @@ static void usage(char *pname)
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"));
@@ -4435,6 +4423,13 @@ static void usage(char *pname)
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;
@@ -4506,9 +4501,6 @@ static void usage(char *pname)
}
}
-#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)
@@ -4604,13 +4596,7 @@ static void usage(char *pname)
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);
@@ -4635,6 +4621,18 @@ static void usage(char *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());
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index d5bca8c5bb..a30f6c2960 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -306,27 +306,35 @@ static void fixtarname(char *tptr, char *fp, int l)
* 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
}
/****************************************************************************
@@ -1203,27 +1211,35 @@ static void unfixtarname(char *tptr, char *fp, int l)
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()