Character set and client code page - one again.

Jeremy Allison jeremy at valinux.com
Wed Jan 5 19:40:24 GMT 2000


Superuser wrote:
> 
>     Hello!
> 
>     Thank  you  for  the  fast  reply. Below is the more detailed
>     description of problems with character set  and  client  code
>     page mapings in samba ver. 2.0.6.

Did you try this patch against the 2.0.6 source code ? I believe
this will fix the character set mapping problems you are having.

Regards,

	Jeremy Allison,
	Samba Team.


--- /home/jeremy/tmp/samba-2.0.6/source/client/client.c	Wed Nov 10 18:35:59 1999
+++ client/client.c	Tue Jan  4 12:22:09 2000
@@ -105,10 +105,6 @@
 
 #define USENMB
 
-#define CNV_LANG(s) dos_to_unix(s,False)
-#define CNV_INPUT(s) unix_to_dos(s,True)
-
-
 /****************************************************************************
 write to a local file with CR/LF->LF translation if appropriate. return the 
 number taken from the buffer. This may not equal the number written.
@@ -237,8 +233,8 @@
 ****************************************************************************/
 static void cmd_pwd(void)
 {
-	DEBUG(0,("Current directory is %s",CNV_LANG(service)));
-	DEBUG(0,("%s\n",CNV_LANG(cur_dir)));
+	DEBUG(0,("Current directory is %s",service));
+	DEBUG(0,("%s\n",cur_dir));
 }
 
 
@@ -288,7 +284,7 @@
 	if (next_token(NULL,buf,NULL,sizeof(buf)))
 		do_cd(buf);
 	else
-		DEBUG(0,("Current directory is %s\n",CNV_LANG(cur_dir)));
+		DEBUG(0,("Current directory is %s\n",cur_dir));
 }
 
 
@@ -326,7 +322,7 @@
 	if (do_this_one(finfo)) {
 		time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
 		DEBUG(0,("  %-30s%7.7s %8.0f  %s",
-			 CNV_LANG(finfo->name),
+			 finfo->name,
 			 attrib_string(finfo->mode),
 			 (double)finfo->size,
 			 asctime(LocalTime(&t))));
@@ -549,7 +545,7 @@
 						strlen(next_file) - 2;
 					*save_ch = '\0';
 				}
-				DEBUG(0,("\n%s\n",CNV_LANG(next_file)));
+				DEBUG(0,("\n%s\n",next_file));
 				if (save_ch)
 				{
 					*save_ch = '\\';
@@ -659,7 +655,7 @@
 	fnum = cli_open(cli, rname, O_RDONLY, DENY_NONE);
 
 	if (fnum == -1) {
-		DEBUG(0,("%s opening remote file %s\n",cli_errstr(cli),CNV_LANG(rname)));
+		DEBUG(0,("%s opening remote file %s\n",cli_errstr(cli),rname));
 		return;
 	}
 
@@ -707,7 +703,7 @@
 
 	if (nread < size) {
 		DEBUG (0, ("Short read when getting file %s. Only got %ld bytes.\n",
-               CNV_LANG(rname), (long)nread));
+               rname, (long)nread));
 	}
 
 	free(data);
@@ -789,10 +785,10 @@
 
 	if (finfo->mode & aDIR)
 		slprintf(quest,sizeof(pstring)-1,
-			 "Get directory %s? ",CNV_LANG(finfo->name));
+			 "Get directory %s? ",finfo->name);
 	else
 		slprintf(quest,sizeof(pstring)-1,
-			 "Get file %s? ",CNV_LANG(finfo->name));
+			 "Get file %s? ",finfo->name);
 
 	if (prompt && !yesno(quest)) return;
 
@@ -815,13 +811,13 @@
 	
 	if (!dos_directory_exist(finfo->name,NULL) && 
 	    dos_mkdir(finfo->name,0777) != 0) {
-		DEBUG(0,("failed to create directory %s\n",CNV_LANG(finfo->name)));
+		DEBUG(0,("failed to create directory %s\n",finfo->name));
 		pstrcpy(cur_dir,saved_curdir);
 		return;
 	}
 	
 	if (dos_chdir(finfo->name) != 0) {
-		DEBUG(0,("failed to chdir to directory %s\n",CNV_LANG(finfo->name)));
+		DEBUG(0,("failed to chdir to directory %s\n",finfo->name));
 		pstrcpy(cur_dir,saved_curdir);
 		return;
 	}
@@ -914,7 +910,7 @@
 {
 	if (!cli_mkdir(cli, name)) {
 		DEBUG(0,("%s making remote directory %s\n",
-			 cli_errstr(cli),CNV_LANG(name)));
+			 cli_errstr(cli),name));
 		return(False);
 	}
 
@@ -989,7 +985,7 @@
 	fnum = cli_open(cli, rname, O_WRONLY|O_CREAT|O_TRUNC, DENY_NONE);
   
 	if (fnum == -1) {
-		DEBUG(0,("%s opening remote file %s\n",cli_errstr(cli),CNV_LANG(rname)));
+		DEBUG(0,("%s opening remote file %s\n",cli_errstr(cli),rname));
 		return;
 	}
 
@@ -1009,7 +1005,7 @@
 
   
 	DEBUG(1,("putting file %s as %s ",lname,
-		 CNV_LANG(rname)));
+		 rname));
   
 	buf = (char *)malloc(maxwrite);
 	while (!feof(f)) {
@@ -1032,7 +1028,7 @@
 	}
 
 	if (!cli_close(cli, fnum)) {
-		DEBUG(0,("%s closing remote file %s\n",cli_errstr(cli),CNV_LANG(rname)));
+		DEBUG(0,("%s closing remote file %s\n",cli_errstr(cli),rname));
 		fclose(f);
 		if (buf) free(buf);
 		return;
@@ -1304,7 +1300,7 @@
 		return;
 
 	if (!cli_unlink(cli, mask)) {
-		DEBUG(0,("%s deleting remote file %s\n",cli_errstr(cli),CNV_LANG(mask)));
+		DEBUG(0,("%s deleting remote file %s\n",cli_errstr(cli),mask));
 	}
 }
 
@@ -1368,7 +1364,7 @@
 
 	if (!cli_rmdir(cli, mask)) {
 		DEBUG(0,("%s removing remote directory file %s\n",
-			 cli_errstr(cli),CNV_LANG(mask)));
+			 cli_errstr(cli),mask));
 	}  
 }
 
@@ -1781,9 +1777,6 @@
 			cmd = p + 1;
 		}
 		
-		/* input language code to internal one */
-		CNV_INPUT (line);
-		
 		/* and get the first part of the command */
 		ptr = line;
 		if (!next_token(&ptr,tok,NULL,sizeof(tok))) continue;
@@ -1791,9 +1784,9 @@
 		if ((i = process_tok(tok)) >= 0) {
 			commands[i].fn();
 		} else if (i == -2) {
-			DEBUG(0,("%s: command abbreviation ambiguous\n",CNV_LANG(tok)));
+			DEBUG(0,("%s: command abbreviation ambiguous\n",tok));
 		} else {
-			DEBUG(0,("%s: command not found\n",CNV_LANG(tok)));
+			DEBUG(0,("%s: command not found\n",tok));
 		}
 	}
 }	
@@ -1808,8 +1801,11 @@
 
 #ifdef HAVE_LIBREADLINE
 /* Minimal readline support, 29Jun1999, s.xenitellis at rhbnc.ac.uk */
-	const int PromptSize = 2048;
-	char prompt_str[PromptSize];	/* This holds the buffer "smb: \dir1\> " */
+#ifdef PROMPTSIZE
+#undef PROMPTSIZE
+#endif
+#define PROMPTSIZE 2048
+	char prompt_str[PROMPTSIZE];	/* This holds the buffer "smb: \dir1\> " */
 	
         char *temp;			/* Gets the buffer from readline() */
 	temp = (char *)NULL;
@@ -1824,7 +1820,7 @@
 			temp = (char *)NULL;
 		}
 
-		snprintf( prompt_str, PromptSize - 1, "smb: %s> ", CNV_LANG(cur_dir) );
+		snprintf( prompt_str, PROMPTSIZE - 1, "smb: %s> ", cur_dir );
 
 		temp = readline( prompt_str );		/* We read the line here */
 
@@ -1837,7 +1833,7 @@
 		strncpy( line, temp, 1023 ); /* Maximum size of (pstring)line. Null is guarranteed. */
 #else 
 		/* display a prompt */
-		DEBUG(0,("smb: %s> ", CNV_LANG(cur_dir)));
+		DEBUG(0,("smb: %s> ", cur_dir));
 		dbgflush( );
 		
 		wait_keyboard();
@@ -1847,9 +1843,6 @@
 			break;
 #endif
 
-		/* input language code to internal one */
-		CNV_INPUT (line);
-		
 		/* special case - first char is ! */
 		if (*line == '!') {
 			system(line + 1);
@@ -1863,9 +1856,9 @@
 		if ((i = process_tok(tok)) >= 0) {
 			commands[i].fn();
 		} else if (i == -2) {
-			DEBUG(0,("%s: command abbreviation ambiguous\n",CNV_LANG(tok)));
+			DEBUG(0,("%s: command abbreviation ambiguous\n",tok));
 		} else {
-			DEBUG(0,("%s: command not found\n",CNV_LANG(tok)));
+			DEBUG(0,("%s: command not found\n",tok));
 		}
 	}
 }

-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------


More information about the samba-technical mailing list