Document the changed name of --no-i-r.
[rsync/rsync.git] / options.c
index c91741c..c868cfe 100644 (file)
--- a/options.c
+++ b/options.c
@@ -461,8 +461,9 @@ static struct poptOption long_options[] = {
   {"no-r",             0,  POPT_ARG_VAL,    &recurse, 0, 0, 0 },
   {"inc-recursive",    0,  POPT_ARG_VAL,    &allow_inc_recurse, 1, 0, 0 },
   {"no-inc-recursive", 0,  POPT_ARG_VAL,    &allow_inc_recurse, 0, 0, 0 },
-  {"ir",               0,  POPT_ARG_VAL,    &allow_inc_recurse, 1, 0, 0 },
-  {"no-ir",            0,  POPT_ARG_VAL,    &allow_inc_recurse, 0, 0, 0 },
+  {"i-r",              0,  POPT_ARG_VAL,    &allow_inc_recurse, 1, 0, 0 },
+  {"no-i-r",           0,  POPT_ARG_VAL,    &allow_inc_recurse, 0, 0, 0 },
+  {"no-ir",            0,  POPT_ARG_VAL,    &allow_inc_recurse, 0, 0, 0 }, /* XXX remove soon */
   {"dirs",            'd', POPT_ARG_VAL,    &xfer_dirs, 2, 0, 0 },
   {"no-dirs",          0,  POPT_ARG_VAL,    &xfer_dirs, 0, 0, 0 },
   {"no-d",             0,  POPT_ARG_VAL,    &xfer_dirs, 0, 0, 0 },
@@ -514,6 +515,8 @@ static struct poptOption long_options[] = {
   {"no-R",             0,  POPT_ARG_VAL,    &relative_paths, 0, 0, 0 },
   {"implied-dirs",     0,  POPT_ARG_VAL,    &implied_dirs, 1, 0, 0 },
   {"no-implied-dirs",  0,  POPT_ARG_VAL,    &implied_dirs, 0, 0, 0 },
+  {"i-d",              0,  POPT_ARG_VAL,    &implied_dirs, 1, 0, 0 },
+  {"no-i-d",           0,  POPT_ARG_VAL,    &implied_dirs, 0, 0, 0 },
   {"chmod",            0,  POPT_ARG_STRING, 0, OPT_CHMOD, 0, 0 },
   {"ignore-times",    'I', POPT_ARG_NONE,   &ignore_times, 0, 0, 0 },
   {"size-only",        0,  POPT_ARG_NONE,   &size_only, 0, 0, 0 },
@@ -593,7 +596,9 @@ static struct poptOption long_options[] = {
   {"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},
-  {"protect-args",    's', POPT_ARG_NONE,   &protect_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},
+  {"no-s",             0,  POPT_ARG_VAL,    &protect_args, 0, 0, 0},
   {"numeric-ids",      0,  POPT_ARG_VAL,    &numeric_ids, 1, 0, 0 },
   {"no-numeric-ids",   0,  POPT_ARG_VAL,    &numeric_ids, 0, 0, 0 },
   {"timeout",          0,  POPT_ARG_INT,    &io_timeout, 0, 0, 0 },
@@ -873,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
 
@@ -1235,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,
@@ -1658,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';
 
@@ -1760,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";
 
@@ -1795,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;
@@ -1845,7 +1858,7 @@ void server_options(char **args, int *argc_p)
                                goto oom;
                        args[ac++] = arg;
                } else if (max_delete == 0)
-                       args[ac++] = "--max_delete=-1";
+                       args[ac++] = "--max-delete=-1";
                if (min_size) {
                        args[ac++] = "--min-size";
                        args[ac++] = min_size_arg;
@@ -1917,7 +1930,7 @@ void server_options(char **args, int *argc_p)
                args[ac++] = "--numeric-ids";
 
        if (!allow_inc_recurse)
-               args[ac++] = "--no-ir";
+               args[ac++] = "--no-ir"; /* XXX change to --no-i-r soon */
 
        if (am_sender) {
                if (ignore_existing)