X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/4fd842f98df4970f6e49a0365dbed60774e56c09..5d935dce63ae975db0efc23e3d94c32b17424444:/options.c diff --git a/options.c b/options.c index 1a110e11..4331fc65 100644 --- a/options.c +++ b/options.c @@ -6,8 +6,9 @@ * Copyright (C) 2002-2007 Wayne Davison * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -108,7 +109,7 @@ size_t bwlimit_writemax = 0; int ignore_existing = 0; int ignore_non_existing = 0; int need_messages_from_generator = 0; -int max_delete = -1; +int max_delete = INT_MIN; OFF_T max_size = 0; OFF_T min_size = 0; int ignore_errors = 0; @@ -118,6 +119,7 @@ int checksum_seed = 0; int inplace = 0; int delay_updates = 0; long block_size = 0; /* "long" because popt can't set an int32. */ +char *skip_compress = NULL; /** Network address family. **/ #ifdef INET6 @@ -334,8 +336,8 @@ void usage(enum logcode F) rprintf(F," --devices preserve device files (super-user only)\n"); rprintf(F," --specials preserve special files\n"); rprintf(F," -D same as --devices --specials\n"); - rprintf(F," -t, --times preserve times\n"); - rprintf(F," -O, --omit-dir-times omit directories when preserving times\n"); + rprintf(F," -t, --times preserve modification times\n"); + rprintf(F," -O, --omit-dir-times omit directories from --times\n"); rprintf(F," --super receiver attempts super-user activities\n"); #ifdef SUPPORT_XATTRS rprintf(F," --fake-super store/recover privileged attrs using xattrs\n"); @@ -378,6 +380,7 @@ void usage(enum logcode F) rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n"); rprintf(F," -z, --compress compress file data during the transfer\n"); rprintf(F," --compress-level=NUM explicitly set compression level\n"); + rprintf(F," --skip-compress=LIST skip compressing files with a suffix in LIST\n"); rprintf(F," -C, --cvs-exclude auto-ignore files the same way CVS does\n"); rprintf(F," -f, --filter=RULE add a file-filtering RULE\n"); rprintf(F," -F same as --filter='dir-merge /.rsync-filter'\n"); @@ -548,6 +551,7 @@ static struct poptOption long_options[] = { {"fuzzy", 'y', POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 }, {"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 }, {"no-compress", 0, POPT_ARG_VAL, &do_compression, 0, 0, 0 }, + {"skip-compress", 0, POPT_ARG_STRING, &skip_compress, 0, 0, 0 }, {"no-z", 0, POPT_ARG_VAL, &do_compression, 0, 0, 0 }, {"compress-level", 0, POPT_ARG_INT, &def_compress_level, 'z', 0, 0 }, {0, 'P', POPT_ARG_NONE, 0, 'P', 0, 0 }, @@ -1287,6 +1291,11 @@ int parse_arguments(int *argc, const char ***argv, int frommain) return 0; } + if (max_delete < 0 && max_delete != INT_MIN) { + /* Negative numbers are treated as "no deletions". */ + max_delete = 0; + } + if (compare_dest + copy_dest + link_dest > 1) { snprintf(err_buf, sizeof err_buf, "You may not mix --compare-dest, --copy-dest, and --link-dest.\n"); @@ -1776,22 +1785,6 @@ void server_options(char **args,int *argc) args[ac++] = arg; } - if (max_delete >= 0 && am_sender) { - if (asprintf(&arg, "--max-delete=%d", max_delete) < 0) - goto oom; - args[ac++] = arg; - } - - if (min_size && am_sender) { - args[ac++] = "--min-size"; - args[ac++] = min_size_arg; - } - - if (max_size && am_sender) { - args[ac++] = "--max-size"; - args[ac++] = max_size_arg; - } - if (io_timeout) { if (asprintf(&arg, "--timeout=%d", io_timeout) < 0) goto oom; @@ -1818,6 +1811,20 @@ void server_options(char **args,int *argc) } if (am_sender) { + if (max_delete > 0) { + if (asprintf(&arg, "--max-delete=%d", max_delete) < 0) + goto oom; + args[ac++] = arg; + } else if (max_delete == 0) + args[ac++] = "--max_delete=-1"; + if (min_size) { + args[ac++] = "--min-size"; + args[ac++] = min_size_arg; + } + if (max_size) { + args[ac++] = "--max-size"; + args[ac++] = max_size_arg; + } if (delete_before) args[ac++] = "--delete-before"; else if (delete_during == 2) @@ -1838,6 +1845,12 @@ void server_options(char **args,int *argc) args[ac++] = "--super"; if (size_only) args[ac++] = "--size-only"; + } else { + if (skip_compress) { + if (asprintf(&arg, "--skip-compress=%s", skip_compress) < 0) + goto oom; + args[ac++] = arg; + } } if (modify_window_set) { @@ -1874,6 +1887,9 @@ void server_options(char **args,int *argc) if (numeric_ids) args[ac++] = "--numeric-ids"; + if (!allow_inc_recurse) + args[ac++] = "--no-ir"; + if (am_sender) { if (ignore_existing) args[ac++] = "--ignore-existing";