diff options
| author | Wayne Davison <wayned@samba.org> | 2004-09-17 16:50:53 +0000 |
|---|---|---|
| committer | Wayne Davison <wayned@samba.org> | 2004-09-17 16:50:53 +0000 |
| commit | 50b31539c26885ec2ff9d566e771f7a1ac2a1e20 (patch) | |
| tree | af768771d62c8155bd177b044a7fa095a635a815 /main.c | |
| parent | 56194bcd9591d2fa5ee75325ac69b93fb411d184 (diff) | |
| download | android_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.c | 36 |
1 files changed, 23 insertions, 13 deletions
@@ -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 */ |
