aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-09-17 16:50:53 +0000
committerWayne Davison <wayned@samba.org>2004-09-17 16:50:53 +0000
commit50b31539c26885ec2ff9d566e771f7a1ac2a1e20 (patch)
treeaf768771d62c8155bd177b044a7fa095a635a815 /main.c
parent56194bcd9591d2fa5ee75325ac69b93fb411d184 (diff)
downloadandroid_external_rsync-50b31539c26885ec2ff9d566e771f7a1ac2a1e20.tar.gz
android_external_rsync-50b31539c26885ec2ff9d566e771f7a1ac2a1e20.tar.bz2
android_external_rsync-50b31539c26885ec2ff9d566e771f7a1ac2a1e20.zip
- Added the ability to parse a literal IPv6 address in an "rsync:" URL
(e.g. rsync://[2001:638:500:101::21]:873/module/dir). - Improved a couple --files-from error messages.
Diffstat (limited to 'main.c')
-rw-r--r--main.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/main.c b/main.c
index 412c2e2d..4f3fd909 100644
--- a/main.c
+++ b/main.c
@@ -775,15 +775,20 @@ static int start_client(int argc, char *argv[])
host = argv[0] + strlen(URL_PREFIX);
p = strchr(host,'/');
if (p) {
- *p = 0;
+ *p = '\0';
path = p+1;
- } else {
+ } else
path = "";
- }
- p = strchr(host,':');
+ if (*host == '[' && (p = strchr(host, ']')) != NULL) {
+ host++;
+ *p++ = '\0';
+ if (*p != ':')
+ p = NULL;
+ } else
+ p = strchr(host, ':');
if (p) {
rsync_port = atoi(p+1);
- *p = 0;
+ *p = '\0';
}
return start_socket_client(host, path, argc-1, argv+1);
}
@@ -795,7 +800,7 @@ static int start_client(int argc, char *argv[])
&& remote_filesfrom_file != files_from + 1
&& strncmp(files_from, argv[0], p-argv[0]+1) != 0) {
rprintf(FERROR,
- "--files-from hostname is not transfer hostname\n");
+ "--files-from hostname is not the same as the transfer hostname\n");
exit_cleanup(RERR_SYNTAX);
}
if (p[1] == ':') { /* double colon */
@@ -828,15 +833,20 @@ static int start_client(int argc, char *argv[])
host = argv[argc-1] + strlen(URL_PREFIX);
p = strchr(host,'/');
if (p) {
- *p = 0;
+ *p = '\0';
path = p+1;
- } else {
+ } else
path = "";
- }
- p = strchr(host,':');
+ if (*host == '[' && (p = strchr(host, ']')) != NULL) {
+ host++;
+ *p++ = '\0';
+ if (*p != ':')
+ p = NULL;
+ } else
+ p = strchr(host, ':');
if (p) {
rsync_port = atoi(p+1);
- *p = 0;
+ *p = '\0';
}
return start_socket_client(host, path, argc-1, argv);
}
@@ -846,14 +856,14 @@ static int start_client(int argc, char *argv[])
&& remote_filesfrom_file != files_from + 1
&& strncmp(files_from, argv[argc-1], p-argv[argc-1]+1) != 0) {
rprintf(FERROR,
- "--files-from hostname is not transfer hostname\n");
+ "--files-from hostname is not the same as the transfer hostname\n");
exit_cleanup(RERR_SYNTAX);
}
if (!p) { /* no colon found, so src & dest are local */
local_server = 1;
if (remote_filesfrom_file) {
rprintf(FERROR,
- "--files-from is remote but transfer is local\n");
+ "--files-from cannot be remote when the transfer is local\n");
exit_cleanup(RERR_SYNTAX);
}
} else if (p[1] == ':') { /* double colon */