Allow the rsync:// URL syntax in the destination field.
authorWayne Davison <wayned@samba.org>
Thu, 1 Aug 2002 17:53:38 +0000 (17:53 +0000)
committerWayne Davison <wayned@samba.org>
Thu, 1 Aug 2002 17:53:38 +0000 (17:53 +0000)
main.c

diff --git a/main.c b/main.c
index cf2674d..de6a62b 100644 (file)
--- a/main.c
+++ b/main.c
@@ -687,7 +687,7 @@ static int start_client(int argc, char *argv[])
                        *p = 0;
                        path = p+1;
                } else {
-                       path="";
+                       path = "";
                }
                p = strchr(host,':');
                if (p) {
@@ -698,7 +698,7 @@ static int start_client(int argc, char *argv[])
        }
 
        if (!read_batch) {
-           p = find_colon(argv[0]);
+               p = find_colon(argv[0]);
 
        if (p) {
                if (p[1] == ':') { /* double colon */
@@ -725,6 +725,26 @@ static int start_client(int argc, char *argv[])
        } else {
                am_sender = 1;
 
+               /* rsync:// destination uses rsync server over direct socket */
+               if (strncasecmp(URL_PREFIX, argv[argc-1], strlen(URL_PREFIX)) == 0) {
+                       char *host, *path;
+
+                       host = argv[argc-1] + strlen(URL_PREFIX);
+                       p = strchr(host,'/');
+                       if (p) {
+                               *p = 0;
+                               path = p+1;
+                       } else {
+                               path = "";
+                       }
+                       p = strchr(host,':');
+                       if (p) {
+                               rsync_port = atoi(p+1);
+                               *p = 0;
+                       }
+                       return start_socket_client(host, path, argc-1, argv);
+               }
+
                p = find_colon(argv[argc-1]);
                if (!p) {
                        local_server = 1;