summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-07-04 07:15:53 +0000
committerAndrew Tridgell <tridge@samba.org>2001-07-04 07:15:53 +0000
commit87fbb7092b8f8b2f0db0f361c3d625e19de57cd9 (patch)
tree3c302f710cbaa03e3c0d46549e8982771b12b8a5 /source3/client
parent9e9e73303ec10a64bd744b9b33f4e6cd7d394f03 (diff)
downloadsamba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.tar.gz
samba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.tar.bz2
samba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.zip
The big character set handling changeover!
This commit gets rid of all our old codepage handling and replaces it with iconv. All internal strings in Samba are now in "unix" charset, which may be multi-byte. See internals.doc and my posting to samba-technical for a more complete explanation. (This used to be commit debb471267960e56005a741817ebd227ecfc512a)
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c38
-rw-r--r--source3/client/clitar.c87
-rw-r--r--source3/client/smbmount.c3
-rw-r--r--source3/client/smbspool.c3
4 files changed, 39 insertions, 92 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index db2866324d..ccbeb72e81 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -190,13 +190,6 @@ static void send_message(void)
msg[l] = c;
}
- /*
- * The message is in UNIX codepage format. Convert to
- * DOS before sending.
- */
-
- unix_to_dos(msg, True);
-
if (!cli_message_text(cli, msg, l, grp_id)) {
printf("SMBsendtxt failed (%s)\n",cli_errstr(cli));
return;
@@ -1645,9 +1638,8 @@ static void browse_fn(const char *name, uint32 m,
case STYPE_IPC:
fstrcpy(typestr,"IPC"); break;
}
-
- printf("\t%-15.15s%-10.10s%s\n",
- name, typestr,comment);
+ printf("\t%-15.15s%-10.10s%s\n",
+ name,typestr,comment);
}
@@ -1682,7 +1674,7 @@ try and browse available connections on a host
static BOOL list_servers(char *wk_grp)
{
if (!cli->server_domain) return False;
-
+
printf("\n\tServer Comment\n");
printf("\t--------- -------\n");
@@ -1928,14 +1920,17 @@ static void process_stdin(void)
while (1) {
fstring tok;
fstring the_prompt;
- char *line;
+ char *cline;
+ pstring line;
int i;
/* display a prompt */
slprintf(the_prompt, sizeof(the_prompt)-1, "smb: %s> ", cur_dir);
- line = smb_readline(the_prompt, readline_callback, completion_fn);
-
- if (!line) break;
+ cline = smb_readline(the_prompt, readline_callback, completion_fn);
+
+ if (!cline) break;
+
+ pstrcpy(line, cline);
/* special case - first char is ! */
if (*line == '!') {
@@ -1961,11 +1956,11 @@ static void process_stdin(void)
/*****************************************************
return a connection to a server
*******************************************************/
-struct cli_state *do_connect(char *server, char *share)
+struct cli_state *do_connect(const char *server, const char *share)
{
struct cli_state *c;
struct nmb_name called, calling;
- char *server_n;
+ const char *server_n;
struct in_addr ip;
extern struct in_addr ipzero;
fstring servicename;
@@ -2058,9 +2053,10 @@ struct cli_state *do_connect(char *server, char *share)
* mode to turn these on/off ? JRA.
*/
- if (*c->server_domain || *c->server_os || *c->server_type)
+ if (*c->server_domain || *c->server_os || *c->server_type){
DEBUG(1,("Domain=[%s] OS=[%s] Server=[%s]\n",
c->server_domain,c->server_os,c->server_type));
+ }
DEBUG(4,(" session setup ok\n"));
@@ -2329,7 +2325,6 @@ static int do_message_op(void)
}
TimeInit();
- charset_initialise();
in_client = True; /* Make sure that we tell lp_load we are */
@@ -2339,8 +2334,6 @@ static int do_message_op(void)
}
DEBUGLEVEL = old_debug;
- codepage_initialise(lp_client_code_page());
-
#ifdef WITH_SSL
sslutil_init(0);
#endif
@@ -2583,9 +2576,6 @@ static int do_message_op(void)
if(*new_name_resolve_order)
lp_set_name_resolve_order(new_name_resolve_order);
- if (*term_code)
- interpret_coding_system(term_code);
-
if (!tar_type && !*query_host && !*service && !message) {
usage(pname);
exit(1);
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 3c35e41155..8f935da4e0 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -421,31 +421,12 @@ static void dotareof(int f)
****************************************************************************/
static void fixtarname(char *tptr, char *fp, int l)
{
- /* add a '.' to start of file name, convert from ugly dos \'s in path
- * to lovely unix /'s :-} */
-
- *tptr++='.';
-
- while (l > 0) {
- int skip = get_character_len(*fp);
- if(skip != 0) {
- if (skip == 2) {
- *tptr++ = *fp++;
- *tptr++ = *fp++;
- l -= 2;
- } else if (skip == 1) {
- *tptr++ = *fp++;
- l--;
- }
- } else if (*fp == '\\') {
- *tptr++ = '/';
- fp++;
- l--;
- } else {
- *tptr++ = *fp++;
- l--;
- }
- }
+ /* add a '.' to start of file name, convert from ugly dos \'s in path
+ * to lovely unix /'s :-} */
+ *tptr++='.';
+
+ safe_strcpy(tptr, fp, l);
+ string_replace(tptr, '\\', '/');
}
/****************************************************************************
@@ -877,43 +858,25 @@ Convert from UNIX to DOS file names
***************************************************************************/
static void unfixtarname(char *tptr, char *fp, int l, BOOL first)
{
- /* remove '.' from start of file name, convert from unix /'s to
- * dos \'s in path. Kill any absolute path names. But only if first!
- */
-
- DEBUG(5, ("firstb=%lX, secondb=%lX, len=%i\n", (long)tptr, (long)fp, l));
-
- if (first) {
- if (*fp == '.') {
- fp++;
- l--;
- }
- if (*fp == '\\' || *fp == '/') {
- fp++;
- l--;
- }
- }
+ /* remove '.' from start of file name, convert from unix /'s to
+ * dos \'s in path. Kill any absolute path names. But only if first!
+ */
+
+ DEBUG(5, ("firstb=%lX, secondb=%lX, len=%i\n", (long)tptr, (long)fp, l));
+
+ if (first) {
+ if (*fp == '.') {
+ fp++;
+ l--;
+ }
+ if (*fp == '\\' || *fp == '/') {
+ fp++;
+ l--;
+ }
+ }
- while (l > 0) {
- int skip = get_character_len(*fp);
- if(skip != 0) {
- if (skip == 2) {
- *tptr++ = *fp++;
- *tptr++ = *fp++;
- l -= 2;
- } else if (skip == 1) {
- *tptr++ = *fp++;
- l--;
- }
- } else if (*fp == '/') {
- *tptr++ = '\\';
- fp++;
- l--;
- } else {
- *tptr++ = *fp++;
- l--;
- }
- }
+ safe_strcpy(tptr, fp, l);
+ string_replace(tptr, '/', '\\');
}
@@ -1718,7 +1681,7 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
SMB_STRUCT_STAT stbuf;
extern time_t newer_than;
- if (dos_stat(argv[Optind], &stbuf) == 0) {
+ if (sys_stat(argv[Optind], &stbuf) == 0) {
newer_than = stbuf.st_mtime;
DEBUG(1,("Getting files newer than %s",
asctime(LocalTime(&newer_than))));
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c
index a121d1fa22..076be0ccb8 100644
--- a/source3/client/smbmount.c
+++ b/source3/client/smbmount.c
@@ -818,7 +818,6 @@ static void parse_mount_smb(int argc, char **argv)
setup_logging("mount.smbfs",True);
TimeInit();
- charset_initialise();
in_client = True; /* Make sure that we tell lp_load we are */
@@ -861,8 +860,6 @@ static void parse_mount_smb(int argc, char **argv)
DEBUG(3,("mount.smbfs started (version %s)\n", VERSION));
- codepage_initialise(lp_client_code_page());
-
if (*workgroup == 0) {
pstrcpy(workgroup,lp_workgroup());
}
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index ce920d1a58..1c85de11dd 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -188,7 +188,6 @@ static int smb_print(struct cli_state *, char *, FILE *);
setup_logging("smbspool", True);
TimeInit();
- charset_initialise();
in_client = True; /* Make sure that we tell lp_load we are */
@@ -201,8 +200,6 @@ static int smb_print(struct cli_state *, char *, FILE *);
if (workgroup == NULL)
workgroup = lp_workgroup();
- codepage_initialise(lp_client_code_page());
-
load_interfaces();
do