X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/3caafdfd2fd654e3d610c62116081697eee02ea1..936fa865e1fd2ea0c97ef1a361f3f35a4153be75:/options.c diff --git a/options.c b/options.c index 63a9e12c..32b574e3 100644 --- a/options.c +++ b/options.c @@ -25,6 +25,7 @@ extern int module_id; extern int sanitize_paths; +extern int daemon_over_rsh; extern struct filter_list_struct filter_list; extern struct filter_list_struct server_filter_list; @@ -95,7 +96,6 @@ int recurse = 0; int allow_inc_recurse = 1; int xfer_dirs = -1; int am_daemon = 0; -int daemon_over_rsh = 0; int do_stats = 0; int do_progress = 0; int keep_partial = 0; @@ -122,10 +122,15 @@ long block_size = 0; /* "long" because popt can't set an int32. */ char *skip_compress = NULL; /** Network address family. **/ +int default_af_hint #ifdef INET6 -int default_af_hint = 0; /* Any protocol */ + = 0; /* Any protocol */ #else -int default_af_hint = AF_INET; /* Must use IPv4 */ + = AF_INET; /* Must use IPv4 */ +# ifdef AF_INET6 +# undef AF_INET6 +# endif +# define AF_INET6 AF_INET /* make -6 option a no-op */ #endif /** Do not go into the background when run as --daemon. Good @@ -314,6 +319,7 @@ void usage(enum logcode F) rprintf(F," -u, --update skip files that are newer on the receiver\n"); rprintf(F," --inplace update destination files in-place (SEE MAN PAGE)\n"); rprintf(F," --append append data onto shorter files\n"); + rprintf(F," --append-verify like --append, but with old data in file checksum\n"); rprintf(F," -d, --dirs transfer directories without recursing\n"); rprintf(F," -l, --links copy symlinks as symlinks\n"); rprintf(F," -L, --copy-links transform symlink into referent file/dir\n"); @@ -414,10 +420,8 @@ void usage(enum logcode F) #ifdef ICONV_OPTION rprintf(F," --iconv=CONVERT_SPEC request charset conversion of filesnames\n"); #endif -#ifdef INET6 rprintf(F," -4, --ipv4 prefer IPv4\n"); rprintf(F," -6, --ipv6 prefer IPv6\n"); -#endif rprintf(F," --version print version number\n"); rprintf(F,"(-h) --help show this help (-h works with no other options)\n"); @@ -431,7 +435,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM, OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP, OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD, OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE, - OPT_NO_D, + OPT_NO_D, OPT_APPEND, OPT_SERVER, OPT_REFUSED_BASE = 9000}; static struct poptOption long_options[] = { @@ -518,7 +522,9 @@ static struct poptOption long_options[] = { {"min-size", 0, POPT_ARG_STRING, &min_size_arg, OPT_MIN_SIZE, 0, 0 }, {"sparse", 'S', POPT_ARG_NONE, &sparse_files, 0, 0, 0 }, {"inplace", 0, POPT_ARG_NONE, &inplace, 0, 0, 0 }, - {"append", 0, POPT_ARG_VAL, &append_mode, 1, 0, 0 }, + {"append", 0, POPT_ARG_NONE, 0, OPT_APPEND, 0, 0 }, + {"append-verify", 0, POPT_ARG_VAL, &append_mode, 2, 0, 0 }, + {"no-append", 0, POPT_ARG_VAL, &append_mode, 0, 0, 0 }, {"del", 0, POPT_ARG_NONE, &delete_during, 0, 0, 0 }, {"delete", 0, POPT_ARG_NONE, &delete_mode, 0, 0, 0 }, {"delete-before", 0, POPT_ARG_NONE, &delete_before, 0, 0, 0 }, @@ -593,10 +599,8 @@ static struct poptOption long_options[] = { #ifdef ICONV_OPTION {"iconv", 0, POPT_ARG_STRING, &iconv_opt, 0, 0, 0 }, #endif -#ifdef INET6 {"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 }, {"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 }, -#endif {"8-bit-output", '8', POPT_ARG_NONE, &allow_8bit_chars, 0, 0, 0 }, {"qsort", 0, POPT_ARG_NONE, &use_qsort, 0, 0, 0 }, {"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 }, @@ -632,10 +636,8 @@ static void daemon_usage(enum logcode F) rprintf(F," --log-file-format=FMT override the \"log format\" setting\n"); rprintf(F," --sockopts=OPTIONS specify custom TCP options\n"); rprintf(F," -v, --verbose increase verbosity\n"); -#ifdef INET6 rprintf(F," -4, --ipv4 prefer IPv4\n"); rprintf(F," -6, --ipv6 prefer IPv6\n"); -#endif rprintf(F," --help show this help screen\n"); rprintf(F,"\n"); @@ -649,10 +651,8 @@ static struct poptOption long_daemon_options[] = { {"bwlimit", 0, POPT_ARG_INT, &daemon_bwlimit, 0, 0, 0 }, {"config", 0, POPT_ARG_STRING, &config_file, 0, 0, 0 }, {"daemon", 0, POPT_ARG_NONE, &daemon_opt, 0, 0, 0 }, -#ifdef INET6 {"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 }, {"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 }, -#endif {"detach", 0, POPT_ARG_VAL, &no_detach, 0, 0, 0 }, {"no-detach", 0, POPT_ARG_VAL, &no_detach, 1, 0, 0 }, {"log-file", 0, POPT_ARG_STRING, &logfile_name, 0, 0, 0 }, @@ -1124,6 +1124,13 @@ int parse_arguments(int *argc, const char ***argv, int frommain) } break; + case OPT_APPEND: + if (am_server) + append_mode++; + else + append_mode = 1; + break; + case OPT_LINK_DEST: #ifdef SUPPORT_HARD_LINKS link_dest = 1; @@ -1616,7 +1623,7 @@ void server_options(char **args,int *argc) /* This should always remain first on the server's command-line. */ args[ac++] = "--server"; - if (daemon_over_rsh) { + if (daemon_over_rsh > 0) { args[ac++] = "--daemon"; *argc = ac; /* if we're passing --daemon, we're done */ @@ -1915,9 +1922,11 @@ void server_options(char **args,int *argc) } } - if (append_mode) + if (append_mode) { + if (append_mode > 1) + args[ac++] = "--append"; args[ac++] = "--append"; - else if (inplace) + } else if (inplace) args[ac++] = "--inplace"; if (files_from && (!am_sender || filesfrom_host)) {