OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, OPT_BLOCK_SIZE,
OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT, OPT_STDERR,
- OPT_OLD_COMPRESS, OPT_NEW_COMPRESS, OPT_NO_COMPRESS,
+ OPT_OLD_COMPRESS, OPT_NEW_COMPRESS, OPT_NO_COMPRESS, OPT_OLD_ARGS,
OPT_STOP_AFTER, OPT_STOP_AT,
OPT_REFUSED_BASE = 9000};
{"files-from", 0, POPT_ARG_STRING, &files_from, 0, 0, 0 },
{"from0", '0', POPT_ARG_VAL, &eol_nulls, 1, 0, 0},
{"no-from0", 0, POPT_ARG_VAL, &eol_nulls, 0, 0, 0},
- {"old-args", 0, POPT_ARG_VAL, &old_style_args, 1, 0, 0},
+ {"old-args", 0, POPT_ARG_NONE, 0, OPT_OLD_ARGS, 0, 0},
{"no-old-args", 0, POPT_ARG_VAL, &old_style_args, 0, 0, 0},
{"protect-args", 's', POPT_ARG_VAL, &protect_args, 1, 0, 0},
{"no-protect-args", 0, POPT_ARG_VAL, &protect_args, 0, 0, 0},
compress_choice = NULL;
break;
+ case OPT_OLD_ARGS:
+ if (old_style_args <= 0)
+ old_style_args = 1;
+ else
+ old_style_args++;
+ break;
+
case 'M':
arg = poptGetOptArg(pc);
if (*arg != '-') {
if (old_style_args < 0) {
if (!am_server && (arg = getenv("RSYNC_OLD_ARGS")) != NULL && *arg)
- old_style_args = atoi(arg) ? 1 : 0;
+ old_style_args = atoi(arg);
else
old_style_args = 0;
}
int len2 = strlen(arg);
int extras = escape_leading_dash ? 2 : 0;
char *ret;
- if (!protect_args && (!old_style_args || (!is_filename_arg && opt != SPLIT_ARG_WHEN_OLD))) {
+ if (!protect_args && old_style_args < 2 && (!old_style_args || (!is_filename_arg && opt != SPLIT_ARG_WHEN_OLD))) {
const char *f;
for (f = arg; *f; f++) {
if (strchr(escapes, *f))
even wildcards escaped). The only active wildcard characters on the remote
side are: `*`, `?`, `[`, & `]`.
- If you have a script that wants to use old-style arg splitting, this option
- should get it going.
+ If you have a script that wants to use old-style arg splitting in the
+ filenames, specify this option once. If the remote shell has a problem
+ with any backslash escapes, specify the option twice.
You may also control this setting via the RSYNC_OLD_ARGS environment
- variable. If this variable has a non-zero value, this setting will be
- enabled by default, otherwise it will be disabled by default. Either state
- is overridden by a manually specified positive or negative version of this
- option (the negative is `--no-old-args`).
+ variable. If it has the value "1", rsync will default to a single-option
+ setting. If it has the value "2" (or more), rsync will default to a
+ repeated-option setting. If it is "0", you'll get the default escaping
+ behavior. The environment is always overridden by manually specified
+ positive or negative options (the negative is `--no-old-args`).
0. `--protect-args`, `-s`
`--files-from` option.
You may also control this setting via the RSYNC_PROTECT_ARGS environment
- variable. If this variable has a non-zero value, this setting will be
+ variable. If it has a non-zero value, this setting will be
enabled by default, otherwise it will be disabled by default. Either state
is overridden by a manually specified positive or negative version of this
option (note that `--no-s` and `--no-protect-args` are the negative
0. `RSYNC_OLD_ARGS`
- Specify a non-zero numeric value if you want the `--old-args` option to be
- enabled by default, or a zero value to make sure that it is disabled by
- default. (First supported in 3.2.4.)
+ Specify a "1" if you want the `--old-args` option to be enabled by default,
+ a "2" (or more) if you want it to be enabled in the option-repeated state,
+ or a "0" to make sure that it is disabled by default. (First supported in
+ 3.2.4.)
0. `RSYNC_PROTECT_ARGS`