svn commit: samba r13161 - in branches/SAMBA_4_0/source/client: .

jelmer at samba.org jelmer at samba.org
Thu Jan 26 11:48:46 GMT 2006


Author: jelmer
Date: 2006-01-26 11:48:45 +0000 (Thu, 26 Jan 2006)
New Revision: 13161

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13161

Log:
Remove optional password as second parameter. Improve return values a bit.

Modified:
   branches/SAMBA_4_0/source/client/client.c


Changeset:
Modified: branches/SAMBA_4_0/source/client/client.c
===================================================================
--- branches/SAMBA_4_0/source/client/client.c	2006-01-26 11:47:45 UTC (rev 13160)
+++ branches/SAMBA_4_0/source/client/client.c	2006-01-26 11:48:45 UTC (rev 13161)
@@ -74,8 +74,6 @@
 	/* remove any double slashes */
 	all_string_sub(s, "\\\\", "\\", 0);
 
-	all_string_sub(s, "/", "\\", 0);
-
 	while ((p = strstr(s,"\\..\\")) != NULL) {
 		*p = '\0';
 		if ((r = strrchr(s,'\\')) != NULL)
@@ -991,7 +989,7 @@
   ****************************************************************************/
 static int cmd_mkdir(struct smbclient_context *ctx, const char **args)
 {
-	char *mask;
+	char *mask, *p;
   
 	if (!args[1]) {
 		if (!ctx->recurse)
@@ -1002,28 +1000,20 @@
 	mask = talloc_asprintf(ctx, "%s%s", ctx->remote_cur_dir,args[1]);
 
 	if (ctx->recurse) {
-		int i;
-		const char **els;
-		char *parent = NULL;
 		dos_clean_name(mask);
 
 		trim_string(mask,".",NULL);
-
-		els = str_list_make(ctx, mask, "/\\");
-
-		for (i = 0; els[i]; i++) {
-			parent = talloc_asprintf_append(parent, "%s\\", els[i]);
+		for (p = strtok(mask,"/\\"); p; p = strtok(p, "/\\")) {
+			char *parent = talloc_strndup(ctx, mask, PTR_DIFF(p, mask));
 			
 			if (NT_STATUS_IS_ERR(smbcli_chkpath(ctx->cli->tree, parent))) { 
 				do_mkdir(ctx, parent);
 			}
-		}	 
 
-
-		talloc_free(parent);
+			talloc_free(parent);
+		}	 
 	} else {
-		if (NT_STATUS_IS_ERR(do_mkdir(ctx, mask)))
-			return 1;
+		do_mkdir(ctx, mask);
 	}
 	
 	return 0;
@@ -2094,13 +2084,10 @@
 		return 1;
 	}
 	mask = talloc_asprintf(ctx, "%s%s", ctx->remote_cur_dir, args[1]);
-	
-	dos_clean_name(mask);
 
 	if (NT_STATUS_IS_ERR(smbcli_rmdir(ctx->cli->tree, mask))) {
-		d_printf("%s removing remote directory %s\n",
+		d_printf("%s removing remote directory file %s\n",
 			 smbcli_errstr(ctx->cli->tree),mask);
-		return 1;
 	}
 	
 	return 0;
@@ -2705,8 +2692,7 @@
 static int process_command_string(struct smbclient_context *ctx, const char *cmd)
 {
 	const char **lines;
-	int i;
-	int rc = 0;
+	int i, rc = 0;
 
 	lines = str_list_make(NULL, cmd, ";");
 	for (i = 0; lines[i]; i++) {
@@ -2950,12 +2936,9 @@
 {
 	int rc = 0;
 	while (1) {
-		char *the_prompt;
-		char *cline;
-		
 		/* display a prompt */
-		the_prompt = talloc_asprintf(ctx, "smb: %s> ", ctx->remote_cur_dir);
-		cline = smb_readline(the_prompt, readline_callback, completion_fn);
+		char *the_prompt = talloc_asprintf(ctx, "smb: %s> ", ctx->remote_cur_dir);
+		char *cline = smb_readline(the_prompt, readline_callback, completion_fn);
 		talloc_free(the_prompt);
 			
 		if (!cline) break;
@@ -2966,7 +2949,7 @@
 			continue;
 		}
 
-		rc |= process_line(ctx, cline); 
+		rc |= process_command_string(ctx, cline); 
 	}
 
 	return rc;



More information about the samba-cvs mailing list