svn commit: samba r9317 - in branches/SOC/SAMBA_3_0/source/client: .
kalim at samba.org
kalim at samba.org
Tue Aug 16 05:34:01 GMT 2005
Author: kalim
Date: 2005-08-16 05:34:01 +0000 (Tue, 16 Aug 2005)
New Revision: 9317
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9317
Log:
Modified authentication callback to pick up command line args.
Added rename command.
-Kalim
Modified:
branches/SOC/SAMBA_3_0/source/client/client.c
Changeset:
Modified: branches/SOC/SAMBA_3_0/source/client/client.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/client/client.c 2005-08-16 05:06:33 UTC (rev 9316)
+++ branches/SOC/SAMBA_3_0/source/client/client.c 2005-08-16 05:34:01 UTC (rev 9317)
@@ -132,34 +132,14 @@
}
else
{
- d_printf("Workgroup: [%s] ", pWorkgroup);
- fgets(temp, sizeof(temp), stdin);
+ d_printf("Workgroup: %s\n", lp_workgroup());
+ strncpy(pWorkgroup, lp_workgroup(), maxLenWorkgroup - 1);
+ strncpy(authWorkgroup, lp_workgroup(), maxLenWorkgroup - 1);
- if (temp[strlen(temp) - 1] == '\n') /* A new line? */
- {
- temp[strlen(temp) - 1] = '\0';
- }
+ d_printf("Username: %s\n", username);
+ strncpy(pUsername, username, maxLenUsername - 1);
+ strncpy(authUsername, username, maxLenUsername - 1);
- if (temp[0] != '\0')
- {
- strncpy(pWorkgroup, temp, maxLenWorkgroup - 1);
- strncpy(authWorkgroup, temp, maxLenWorkgroup - 1);
- }
-
- d_printf("Username: [%s] ", pUsername);
- fgets(temp, sizeof(temp), stdin);
-
- if (temp[strlen(temp) - 1] == '\n') /* A new line? */
- {
- temp[strlen(temp) - 1] = '\0';
- }
-
- if (temp[0] != '\0')
- {
- strncpy(pUsername, temp, maxLenUsername - 1);
- strncpy(authUsername, pUsername, maxLenUsername - 1);
- }
-
char *pass = getpass("Password: ");
if (pass)
fstrcpy(temp, pass);
@@ -2378,27 +2358,34 @@
static int cmd_rename(void)
{
- pstring src,dest;
- pstring buf,buf2;
+ int err;
+ pstring src, dest;
+ pstring oname, nname;
- pstrcpy(src,cur_dir);
- pstrcpy(dest,cur_dir);
+ pstrcpy(src, "smb:");
+ pstrcat(src, service);
+ pstrcat(src, cur_dir);
+ pstrcpy(dest, src);
- if (!next_token_nr(NULL,buf,NULL,sizeof(buf)) ||
- !next_token_nr(NULL,buf2,NULL, sizeof(buf2))) {
+ if (!next_token_nr(NULL,oname,NULL,sizeof(oname)) ||
+ !next_token_nr(NULL,nname,NULL, sizeof(nname))) {
d_printf("rename <src> <dest>\n");
return 1;
}
- pstrcat(src,buf);
- pstrcat(dest,buf2);
+ pstrcat(src, oname);
+ pstrcat(dest, nname);
+
+ d_printf("O: %s\nN: %s\n", src, dest);
- if (!cli_rename(cli, src, dest)) {
- d_printf("%s renaming files\n",cli_errstr(cli));
- return 1;
- }
-
- return 0;
+ err = smbc_rename(src, dest);
+ if (err < 0)
+ {
+ d_printf("%s renaming files\n", strerror(errno));
+ return 1;
+ }
+
+ return 0;
}
/****************************************************************************
@@ -2887,7 +2874,7 @@
{"rd",cmd_rmdir,"<directory> remove a directory",{COMPL_NONE,COMPL_NONE}},
{"recurse",cmd_recurse,"toggle directory recursion for mget and mput",{COMPL_NONE,COMPL_NONE}},
/* {"reget",cmd_reget,"<remote name> [local name] get a file restarting at end of local file",{COMPL_REMOTE,COMPL_LOCAL}},*/
-/* {"rename",cmd_rename,"<src> <dest> rename some files",{COMPL_REMOTE,COMPL_REMOTE}},*/
+ {"rename",cmd_rename,"<src> <dest> rename some files",{COMPL_REMOTE,COMPL_REMOTE}},
/* {"reput",cmd_reput,"<local name> [remote name] put a file restarting at end of remote file",{COMPL_LOCAL,COMPL_REMOTE}},*/
/* {"rm",cmd_del,"<mask> delete all matching files",{COMPL_REMOTE,COMPL_NONE}},*/
{"rmdir",cmd_rmdir,"<directory> remove a directory",{COMPL_NONE,COMPL_NONE}},
More information about the samba-cvs
mailing list