X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/1f30a674cdbdb464b74181c2ef8588fa48b74ab1..9118a09c770b6ae6f136395c087e76e3768167a8:/options.c diff --git a/options.c b/options.c index 4d3d0385..280df0e2 100644 --- a/options.c +++ b/options.c @@ -143,6 +143,8 @@ 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; int always_checksum = 0; int list_only = 0; @@ -539,8 +541,7 @@ static void set_refuse_options(char *bp) if (!op->longName && !*shortname) break; if ((op->longName && wildmatch(bp, op->longName)) - || (*shortname && wildmatch(bp, shortname)) - || op->val == OPT_DAEMON) { + || (*shortname && wildmatch(bp, shortname))) { if (op->argInfo == POPT_ARG_VAL) op->argInfo = POPT_ARG_NONE; op->val = (op - long_options) + OPT_REFUSED_BASE; @@ -576,6 +577,17 @@ static void set_refuse_options(char *bp) *cp = ' '; bp = cp + 1; } + + for (op = long_options; ; op++) { + *shortname = op->shortName; + if (!op->longName && !*shortname) + break; + if (op->val == OPT_DAEMON) { + if (op->argInfo == POPT_ARG_VAL) + op->argInfo = POPT_ARG_NONE; + op->val = (op - long_options) + OPT_REFUSED_BASE; + } + } } @@ -1057,12 +1069,13 @@ int parse_arguments(int *argc, const char ***argv, int frommain) if (log_format) { if (strstr(log_format, "%i") != NULL) - itemize_changes = 1; + log_format_has_i = 1; if (strstr(log_format, "%b") == NULL && strstr(log_format, "%c") == NULL) log_before_transfer = !am_server; } else if (itemize_changes) { log_format = "%i %n%L"; + log_format_has_i = 1; log_before_transfer = !am_server; } @@ -1074,6 +1087,9 @@ 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)) + log_format_has_o_or_i = 1; if (daemon_bwlimit && (!bwlimit || bwlimit > daemon_bwlimit)) bwlimit = daemon_bwlimit; @@ -1224,8 +1240,6 @@ void server_options(char **args,int *argc) * default for remote transfers, and in any case old versions * of rsync will not understand it. */ - if (itemize_changes) - argstr[x++] = 'i'; if (preserve_hard_links) argstr[x++] = 'H'; if (preserve_uid) @@ -1271,10 +1285,16 @@ void server_options(char **args,int *argc) if (list_only > 1) args[ac++] = "--list-only"; - /* The server side doesn't use our log-format, but if verbose isn't - * on, they may need to know that we want some extra messages. */ - if (log_format && !verbose && !itemize_changes) - args[ac++] = "--log-format=specified"; + /* The server side doesn't use our log-format, but in certain + * circumstances they need to know a little about the option. */ + if (log_format && am_sender) { + if (log_format_has_i) + args[ac++] = "--log-format=%i"; + else if (log_format_has_o_or_i) + args[ac++] = "--log-format=%o"; + else if (!verbose) + args[ac++] = "--log-format=X"; + } if (block_size) { if (asprintf(&arg, "-B%lu", block_size) < 0)