Allows --address to be used in client mode.
[rsync/rsync.git] / options.c
index 301178d..08df879 100644 (file)
--- a/options.c
+++ b/options.c
@@ -150,7 +150,6 @@ char *dest_option = NULL;
 
 int verbose = 0;
 int quiet = 0;
-int itemize_changes = 0;
 int log_before_transfer = 0;
 int log_format_has_i = 0;
 int log_format_has_o_or_i = 0;
@@ -163,6 +162,7 @@ char *batch_name = NULL;
 static int daemon_opt;   /* sets am_daemon after option error-reporting */
 static int F_option_cnt = 0;
 static int modify_window_set;
+static int itemize_changes = 0;
 static int refused_delete, refused_archive_part;
 static int refused_partial, refused_progress, refused_delete_before;
 static char *max_size_arg;
@@ -332,6 +332,7 @@ void usage(enum logcode F)
   rprintf(F,"     --files-from=FILE       read list of source-file names from FILE\n");
   rprintf(F," -0, --from0                 all *-from file lists are delimited by nulls\n");
   rprintf(F,"     --version               print version number\n");
+  rprintf(F,"     --address=ADDRESS       bind address for outgoing socket to daemon\n");
   rprintf(F,"     --port=PORT             specify double-colon alternate port number\n");
   rprintf(F,"     --blocking-io           use blocking I/O for the remote shell\n");
   rprintf(F,"     --no-blocking-io        turn off blocking I/O when it is the default\n");
@@ -345,6 +346,7 @@ void usage(enum logcode F)
   rprintf(F,"     --bwlimit=KBPS          limit I/O bandwidth; KBytes per second\n");
   rprintf(F,"     --write-batch=FILE      write a batched update to FILE\n");
   rprintf(F,"     --read-batch=FILE       read a batched update from FILE\n");
+  rprintf(F,"     --protocol=NUM          force an older protocol version to be used\n");
 #ifdef INET6
   rprintf(F," -4, --ipv4                  prefer IPv4\n");
   rprintf(F," -6, --ipv6                  prefer IPv6\n");
@@ -441,6 +443,7 @@ static struct poptOption long_options[] = {
   {"no-blocking-io",   0,  POPT_ARG_VAL,    &blocking_io, 0, 0, 0 },
   {0,                 'F', POPT_ARG_NONE,   0, 'F', 0, 0 },
   {0,                 'P', POPT_ARG_NONE,   0, 'P', 0, 0 },
+  {"address",          0,  POPT_ARG_STRING, &bind_address, 0, 0, 0 },
   {"port",             0,  POPT_ARG_INT,    &rsync_port, 0, 0, 0 },
   {"log-format",       0,  POPT_ARG_STRING, &log_format, 0, 0, 0 },
   {"itemize-changes", 'i', POPT_ARG_NONE,   &itemize_changes, 0, 0, 0 },
@@ -459,7 +462,6 @@ static struct poptOption long_options[] = {
   {"ipv6",            '6', POPT_ARG_VAL,    &default_af_hint, AF_INET6, 0, 0 },
 #endif
   /* All these options switch us into daemon-mode option-parsing. */
-  {"address",          0,  POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 },
   {"config",           0,  POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 },
   {"daemon",           0,  POPT_ARG_NONE,   0, OPT_DAEMON, 0, 0 },
   {"detach",           0,  POPT_ARG_NONE,   0, OPT_DAEMON, 0, 0 },
@@ -1077,10 +1079,10 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                omit_dir_times = 1;
 
        if (log_format) {
-               if (strstr(log_format, "%i") != NULL)
+               if (log_format_has(log_format, 'i'))
                        log_format_has_i = 1;
-               if (strstr(log_format, "%b") == NULL
-                && strstr(log_format, "%c") == NULL)
+               if (!log_format_has(log_format, 'b')
+                && !log_format_has(log_format, 'c'))
                        log_before_transfer = !am_server;
        } else if (itemize_changes) {
                log_format = "%i %n%L";
@@ -1096,8 +1098,7 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                log_format = "%n%L";
                log_before_transfer = !am_server;
        }
-       if (log_format_has_i
-           || (log_format && strstr(log_format, "%o") != NULL))
+       if (log_format_has_i || log_format_has(log_format, 'o'))
                log_format_has_o_or_i = 1;
 
        if (daemon_bwlimit && (!bwlimit || bwlimit > daemon_bwlimit))