diff options
author | Wayne Davison <wayned@samba.org> | 2007-09-18 01:11:54 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2007-09-18 01:11:54 +0000 |
commit | a4453606ccf4aa3853588af2883d77d4e4df81bc (patch) | |
tree | 11bbba92e0291071832a324a6cc129f7fac8f4ab /options.c | |
parent | 71605b0f4d554c06e0e4ee1f3180adbdb02d441d (diff) | |
download | rsync-a4453606ccf4aa3853588af2883d77d4e4df81bc.tar.gz rsync-a4453606ccf4aa3853588af2883d77d4e4df81bc.tar.bz2 rsync-a4453606ccf4aa3853588af2883d77d4e4df81bc.zip |
- Improved -s support.
- Handle setup_iconv() call in parse_arguments() so it gets set early.
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 52 |
1 files changed, 30 insertions, 22 deletions
@@ -878,7 +878,7 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain) set_refuse_options("log-file*"); #ifdef ICONV_OPTION - if (!am_daemon && (arg = getenv("RSYNC_ICONV")) != NULL && *arg) + if (!am_daemon && !protect_args && (arg = getenv("RSYNC_ICONV")) != NULL && *arg) iconv_opt = strdup(arg); #endif @@ -1240,22 +1240,23 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain) exit_cleanup(0); } - if (protect_args) { - if (!frommain) - protect_args = 0; - else if (am_server) - return 1; - } - #ifdef ICONV_OPTION - if (iconv_opt) { + if (iconv_opt && protect_args != 2) { if (!am_server && strcmp(iconv_opt, "-") == 0) iconv_opt = NULL; else need_unsorted_flist = 1; } + setup_iconv(); #endif + if (protect_args == 1) { + if (!frommain) + protect_args = 0; + else if (am_server) + return 1; + } + #ifndef SUPPORT_LINKS if (preserve_links && !am_sender) { snprintf(err_buf, sizeof err_buf, @@ -1663,6 +1664,10 @@ void server_options(char **args, int *argc_p) x = 1; argstr[0] = '-'; + + if (protect_args) + argstr[x++] = 's'; + for (i = 0; i < verbose; i++) argstr[x++] = 'v'; @@ -1765,6 +1770,22 @@ void server_options(char **args, int *argc_p) if (x != 1) args[ac++] = argstr; +#ifdef ICONV_OPTION + if (iconv_opt) { + char *set = strchr(iconv_opt, ','); + if (set) + set++; + else + set = iconv_opt; + if (asprintf(&arg, "--iconv=%s", set) < 0) + goto oom; + args[ac++] = arg; + } +#endif + + if (protect_args) /* initial args break here */ + args[ac++] = NULL; + if (list_only > 1) args[ac++] = "--list-only"; @@ -1800,19 +1821,6 @@ void server_options(char **args, int *argc_p) args[ac++] = "--log-format=X"; } -#ifdef ICONV_OPTION - if (iconv_opt) { - char *set = strchr(iconv_opt, ','); - if (set) - set++; - else - set = iconv_opt; - if (asprintf(&arg, "--iconv=%s", set) < 0) - goto oom; - args[ac++] = arg; - } -#endif - if (block_size) { if (asprintf(&arg, "-B%lu", block_size) < 0) goto oom; |