+--- options.c 27 May 2004 21:51:53 -0000 1.153
++++ options.c 28 May 2004 21:56:09 -0000
+@@ -48,6 +48,7 @@ int preserve_gid = 0;
+ int preserve_times = 0;
+ int update_only = 0;
+ int cvs_exclude = 0;
++int inherit_exclude_levels = -9999;
+ int dry_run = 0;
+ int local_server = 0;
+ int ignore_times = 0;
+@@ -306,7 +307,7 @@ void usage(enum logcode F)
+
+ enum {OPT_VERSION = 1000, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+ OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, OPT_LINK_DEST,
+- OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
++ OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_INHERIT, OPT_MODIFY_WINDOW,
+ OPT_READ_BATCH, OPT_WRITE_BATCH,
+ OPT_REFUSED_BASE = 9000};
+
+@@ -331,6 +332,7 @@ static struct poptOption long_options[]
+ {"include", 0, POPT_ARG_STRING, 0, OPT_INCLUDE, 0, 0 },
+ {"exclude-from", 0, POPT_ARG_STRING, 0, OPT_EXCLUDE_FROM, 0, 0 },
+ {"include-from", 0, POPT_ARG_STRING, 0, OPT_INCLUDE_FROM, 0, 0 },
++ {"inherit", 0, POPT_ARG_STRING, 0, OPT_INHERIT, 0, 0 },
+ {"safe-links", 0, POPT_ARG_NONE, &safe_symlinks, 0, 0, 0 },
+ {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0 },
+ {"backup", 'b', POPT_ARG_NONE, &make_backups, 0, 0, 0 },
+@@ -543,6 +545,31 @@ int parse_arguments(int *argc, const cha
+ XFLG_FATAL_ERRORS | XFLG_DEF_INCLUDE);
+ break;
+
++ case OPT_INHERIT:
++ arg = poptGetOptArg(pc);
++ if (isdigit(*arg))
++ inherit_exclude_levels = atoi(arg);
++ else if (*arg == '.') {
++ if (!arg[1])
++ inherit_exclude_levels = 0;
++ else if (arg[1] == '.') {
++ inherit_exclude_levels = 0;
++ arg--;
++ do {
++ inherit_exclude_levels++;
++ arg += 3;
++ } while (strncmp(arg, "/..", 3) == 0);
++ if (*arg)
++ inherit_exclude_levels = -1;
++ }
++ }
++ if (inherit_exclude_levels < 0) {
++ snprintf(err_buf, sizeof err_buf,
++ "Invalid argument given to --inherit.\n");
++ return 0;
++ }
++ break;
++
+ case 'h':
+ usage(FINFO);
+ exit_cleanup(0);
+@@ -767,6 +794,9 @@ int parse_arguments(int *argc, const cha
+ }
+ }
+
++ if (inherit_exclude_levels < 0)
++ inherit_exclude_levels = -1;
++
+ return 1;
+ }
+
+@@ -866,6 +896,12 @@ void server_options(char **args,int *arg
+ if (x != 1)
+ args[ac++] = argstr;
+
++ if (inherit_exclude_levels >= 0) {
++ if (asprintf(&arg, "--inherit=%d", inherit_exclude_levels) < 0)
++ goto oom;
++ args[ac++] = arg;
++ }
++
+ if (block_size) {
+ if (asprintf(&arg, "-B%u", block_size) < 0)
+ goto oom;