Patch from J.W. Schultz to have --include-from and --exclude-from on
[rsync/rsync.git] / options.c
index 1652aed..7ed8823 100644 (file)
--- a/options.c
+++ b/options.c
@@ -66,7 +66,8 @@ int module_id = -1;
 int am_server = 0;
 int am_sender = 0;
 int recurse = 0;
-int am_daemon=0;
+int am_daemon = 0;
+int daemon_over_rsh = 0;
 int do_stats=0;
 int do_progress=0;
 int keep_partial=0;
@@ -102,6 +103,7 @@ int no_detach = 0;
 
 int write_batch = 0;
 int read_batch = 0;
+int suffix_specified = 0;
 
 char *backup_suffix = BACKUP_SUFFIX;
 char *tmpdir = NULL;
@@ -200,6 +202,7 @@ void usage(enum logcode F)
   rprintf(F,"  or   rsync [OPTION]... [USER@]HOST::SRC [DEST]\n");
   rprintf(F,"  or   rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST\n");
   rprintf(F,"  or   rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]\n");
+  rprintf(F,"  or   rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST\n");
   rprintf(F,"SRC on single-colon remote HOST will be expanded by remote shell\n");
   rprintf(F,"SRC on server remote HOST may contain shell wildcards or multiple\n");
   rprintf(F,"  sources separated by space as long as they have same top-level\n");
@@ -296,7 +299,7 @@ enum {OPT_VERSION = 1000, OPT_SUFFIX, OPT_SENDER, OPT_SERVER, OPT_EXCLUDE,
 static struct poptOption long_options[] = {
   /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
   {"version",          0,  POPT_ARG_NONE,   0,             OPT_VERSION, 0, 0},
-  {"suffix",           0,  POPT_ARG_STRING, &backup_suffix,    0, 0, 0 },
+  {"suffix",           0,  POPT_ARG_STRING, &backup_suffix,    OPT_SUFFIX, 0, 0 },
   {"rsync-path",       0,  POPT_ARG_STRING, &rsync_path,       0, 0, 0 },
   {"password-file",    0,  POPT_ARG_STRING, &password_file,    0, 0, 0 },
   {"ignore-times",    'I', POPT_ARG_NONE,   &ignore_times , 0, 0, 0 },
@@ -470,6 +473,13 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                         print_rsync_version(FINFO);
                        exit_cleanup(0);
                        
+               case OPT_SUFFIX:
+                        /* The value has already been set by popt, but
+                         * we need to remember that a suffix was specified
+                         * in case a backup-directory is used. */
+                        suffix_specified = 1;
+                       break;
+                       
                case OPT_MODIFY_WINDOW:
                         /* The value has already been set by popt, but
                          * we need to remember that we're using a
@@ -647,6 +657,13 @@ void server_options(char **args,int *argc)
 
        args[ac++] = "--server";
 
+       if (daemon_over_rsh) {
+               args[ac++] = "--daemon";
+               *argc = ac;
+               /* if we're passing --daemon, we're done */
+               return;
+       }
+
        if (!am_sender)
                args[ac++] = "--sender";