X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/24d677fc16b62a3b6c320e3edb5016b5fa193e8b..968061bb65203ca9b0683ade0bf4bf238b8ce062:/options.c diff --git a/options.c b/options.c index 77d52f3e..77cbe10e 100644 --- a/options.c +++ b/options.c @@ -56,7 +56,6 @@ int preserve_specials = 0; int preserve_uid = 0; int preserve_gid = 0; int preserve_times = 0; -int omit_dir_times = 0; int update_only = 0; int cvs_exclude = 0; int dry_run = 0; @@ -192,6 +191,7 @@ char *iconv_opt = ICONV_OPTION; struct chmod_mode_struct *chmod_modes = NULL; static int daemon_opt; /* sets am_daemon after option error-reporting */ +static int omit_dir_times = 0; static int F_option_cnt = 0; static int modify_window_set; static int itemize_changes = 0; @@ -319,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"); @@ -434,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[] = { @@ -473,10 +474,12 @@ static struct poptOption long_options[] = { {"xattrs", 'X', POPT_ARG_NONE, 0, 'X', 0, 0 }, {"no-xattrs", 0, POPT_ARG_VAL, &preserve_xattrs, 0, 0, 0 }, {"no-X", 0, POPT_ARG_VAL, &preserve_xattrs, 0, 0, 0 }, - {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 }, + {"times", 't', POPT_ARG_VAL, &preserve_times, 2, 0, 0 }, {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, - {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 }, + {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 1, 0, 0 }, + {"no-omit-dir-times",0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 }, + {"no-O", 0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 }, {"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 }, {"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 }, {"no-super", 0, POPT_ARG_VAL, &am_root, 0, 0, 0 }, @@ -521,7 +524,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 }, @@ -1012,7 +1017,7 @@ int parse_arguments(int *argc, const char ***argv, int frommain) preserve_links = 1; #endif preserve_perms = 1; - preserve_times = 1; + preserve_times = 2; preserve_gid = 1; preserve_uid = 1; preserve_devices = 1; @@ -1121,6 +1126,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; @@ -1417,8 +1429,15 @@ int parse_arguments(int *argc, const char ***argv, int frommain) "P *%s", backup_suffix); parse_rule(&filter_list, backup_dir_buf, 0, 0); } - if (make_backups && !backup_dir) - omit_dir_times = 1; + + if (make_backups && !backup_dir) { + omit_dir_times = 0; /* Implied, so avoid -O to sender. */ + if (preserve_times > 1) + preserve_times = 1; + } else if (omit_dir_times) { + if (preserve_times > 1) + preserve_times = 1; + } if (stdout_format) { if (am_server && log_format_has(stdout_format, 'I')) @@ -1644,7 +1663,7 @@ void server_options(char **args,int *argc) argstr[x++] = 'K'; if (prune_empty_dirs) argstr[x++] = 'm'; - if (omit_dir_times == 2) + if (omit_dir_times) argstr[x++] = 'O'; } else { if (copy_links) @@ -1912,9 +1931,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)) {