This patch adds the --append option, which works like a "resume" mode in
an ftp client, appending new data onto the end of the files it updates.
---- orig/generator.c 2005-02-11 20:25:07
-+++ generator.c 2005-02-11 20:26:31
-@@ -40,6 +40,7 @@ extern int delete_during;
+--- orig/generator.c 2005-02-15 19:27:04
++++ generator.c 2005-02-15 19:31:13
+@@ -41,6 +41,7 @@ extern int delete_during;
extern int update_only;
extern int opt_ignore_existing;
extern int inplace;
extern int make_backups;
extern int csum_length;
extern int ignore_times;
-@@ -192,35 +193,42 @@ static void generate_and_send_sums(int f
+@@ -245,35 +246,42 @@ static void generate_and_send_sums(int f
OFF_T offset = 0;
sum_sizes_sqroot(&sum, len);
}
if (mapbuf)
-@@ -509,6 +517,9 @@ static void recv_generator(char *fname,
+@@ -685,6 +693,9 @@ static void recv_generator(char *fname,
return;
}
+
if (!compare_dest && fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
;
- else if (unchanged_file(fnamecmp, file, &st)) {
-@@ -527,7 +538,7 @@ prepare_to_open:
+ else if (fnamecmp_type == FNAMECMP_FUZZY)
+@@ -710,7 +721,7 @@ prepare_to_open:
if (dry_run || read_batch)
goto notify_others;
- if (whole_file > 0) {
+ if (whole_file > 0 && !append_mode) {
- statret = -1;
+ if (statret == 0)
+ statret = 1;
goto notify_others;
- }
-@@ -664,6 +675,9 @@ void generate_files(int f_out, struct fi
+@@ -876,6 +887,9 @@ void generate_files(int f_out, struct fi
csum_length = SUM_LENGTH;
only_existing = max_size = opt_ignore_existing = 0;
update_only = always_checksum = size_only = 0;
ignore_times = 1;
if (verbose > 2)
---- orig/match.c 2005-01-17 23:11:45
+--- orig/match.c 2005-02-15 19:27:04
+++ match.c 2005-02-11 20:26:31
@@ -23,6 +23,7 @@ extern int verbose;
extern int am_server;
int updating_basis_file;
-@@ -336,6 +337,21 @@ void match_sums(int f, struct sum_struct
+@@ -334,6 +335,21 @@ void match_sums(int f, struct sum_struct
sum_init(checksum_seed);
if (len > 0 && s->count > 0) {
build_hash_table(s);
-@@ -349,7 +365,7 @@ void match_sums(int f, struct sum_struct
+@@ -347,7 +363,7 @@ void match_sums(int f, struct sum_struct
} else {
OFF_T j;
/* by doing this in pieces we avoid too many seeks */
matched(f, s, buf, j, -2);
matched(f, s, buf, len, -1);
}
---- orig/options.c 2005-02-11 18:21:45
+--- orig/options.c 2005-02-15 19:27:05
+++ options.c 2005-02-11 20:31:32
@@ -39,6 +39,7 @@ int make_backups = 0;
**/
int archive_mode = 0;
int keep_dirlinks = 0;
int copy_links = 0;
-@@ -150,7 +151,7 @@ static int daemon_opt; /* sets am_daem
+@@ -152,7 +153,7 @@ static int daemon_opt; /* sets am_daem
static int F_option_cnt = 0;
static int modify_window_set;
static int refused_verbose, refused_delete, refused_archive_part;
static char *dest_option = NULL;
static char *max_size_arg;
static char partialdir_for_delayupdate[] = ".~tmp~";
-@@ -260,6 +261,7 @@ void usage(enum logcode F)
+@@ -262,6 +263,7 @@ void usage(enum logcode F)
rprintf(F," --suffix=SUFFIX set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
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," -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");
-@@ -383,6 +385,7 @@ static struct poptOption long_options[]
+@@ -387,6 +389,7 @@ static struct poptOption long_options[]
{"links", 'l', POPT_ARG_NONE, &preserve_links, 0, 0, 0 },
{"copy-links", 'L', POPT_ARG_NONE, ©_links, 0, 0, 0 },
{"keep-dirlinks", 'K', POPT_ARG_NONE, &keep_dirlinks, 0, 0, 0 },
+ {"append", 0, POPT_ARG_VAL, &append_mode, 1, 0, 0 },
{"whole-file", 'W', POPT_ARG_VAL, &whole_file, 1, 0, 0 },
{"no-whole-file", 0, POPT_ARG_VAL, &whole_file, 0, 0, 0 },
- {"copy-unsafe-links", 0, POPT_ARG_NONE, ©_unsafe_links, 0, 0, 0 },
-@@ -555,6 +558,8 @@ static void set_refuse_options(char *bp)
+ {"copy-unsafe-links",0, POPT_ARG_NONE, ©_unsafe_links, 0, 0, 0 },
+@@ -561,6 +564,8 @@ static void set_refuse_options(char *bp)
refused_partial = op->val;
else if (wildmatch("progress", op->longName))
refused_progress = op->val;
break;
}
if (!is_wild)
-@@ -1060,6 +1065,14 @@ int parse_arguments(int *argc, const cha
+@@ -1066,6 +1071,14 @@ int parse_arguments(int *argc, const cha
bwlimit_writemax = 512;
}
if (delay_updates && !partial_dir)
partial_dir = partialdir_for_delayupdate;
-@@ -1346,7 +1359,9 @@ void server_options(char **args,int *arg
+@@ -1354,7 +1367,9 @@ void server_options(char **args,int *arg
if (opt_ignore_existing && am_sender)
args[ac++] = "--ignore-existing";
args[ac++] = "--inplace";
if (tmpdir) {
---- orig/receiver.c 2005-02-11 10:53:14
+--- orig/receiver.c 2005-02-15 19:27:05
+++ receiver.c 2005-02-11 20:26:32
-@@ -44,6 +44,7 @@ extern int cleanup_got_literal;
+@@ -45,6 +45,7 @@ extern int cleanup_got_literal;
extern int module_id;
extern int ignore_errors;
extern int orig_umask;
extern int keep_partial;
extern int checksum_seed;
extern int inplace;
-@@ -164,6 +165,28 @@ static int receive_data(int f_in, char *
+@@ -165,6 +166,28 @@ static int receive_data(int f_in, char *
sum_init(checksum_seed);
while ((i = recv_token(f_in, &data)) != 0) {
if (do_progress)
show_progress(offset, total_size);
-@@ -325,6 +348,7 @@ int recv_files(int f_in, struct file_lis
+@@ -356,6 +379,7 @@ int recv_files(int f_in, struct file_lis
send_msg(MSG_DONE, "", 0);
if (keep_partial && !partial_dir)
make_backups = 0; /* prevents double backup */
continue;
}
---- orig/rsync.yo 2005-02-11 10:53:15
+--- orig/rsync.yo 2005-02-15 19:27:05
+++ rsync.yo 2005-02-11 20:36:38
@@ -309,6 +309,7 @@ to the detailed description below for a
--suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)
-d, --dirs transfer directories without recursing
-l, --links copy symlinks as symlinks
-L, --copy-links transform symlink into referent file/dir
-@@ -553,6 +554,14 @@ should not use this option to update fil
+@@ -555,6 +556,14 @@ should not use this option to update fil
rsync will be unable to update a file in-place that is not writable by the
receiving user.
dit(bf(-d, --dirs)) Tell the sending side to include any directories that
are encountered. Unlike bf(--recursive), a directory's contents are not copied
unless the directory was specified on the command-line as either "." or a
---- orig/sender.c 2005-02-03 02:04:20
+--- orig/sender.c 2005-02-15 19:27:05
+++ sender.c 2005-02-11 20:26:32
-@@ -30,6 +30,7 @@ extern int protocol_version;
+@@ -31,6 +31,7 @@ extern int protocol_version;
extern int updating_basis_file;
extern int make_backups;
extern int inplace;
extern struct stats stats;
-@@ -62,6 +63,13 @@ static struct sum_struct *receive_sums(i
+@@ -63,6 +64,13 @@ static struct sum_struct *receive_sums(i
(double)s->count, (long)s->blength, (long)s->remainder);
}
if (s->count == 0)
return(s);
-@@ -127,6 +135,7 @@ void send_files(struct file_list *flist,
+@@ -128,6 +136,7 @@ void send_files(struct file_list *flist,
/* For inplace: redo phase turns off the backup
* flag so that we do a regular inplace send. */
make_backups = 0;
+ }
+ return 0;
+}
---- orig/flist.c 2005-02-09 02:37:15
+--- orig/flist.c 2005-02-14 02:45:10
+++ flist.c 2004-09-18 01:51:11
-@@ -69,6 +69,8 @@ extern int max_delete;
+@@ -68,6 +68,8 @@ extern int max_delete;
extern int orig_umask;
extern int list_only;
extern struct filter_list_struct filter_list;
extern struct filter_list_struct server_filter_list;
-@@ -885,7 +887,10 @@ skip_filters:
+@@ -886,7 +888,10 @@ skip_filters:
file->flags = flags;
file->modtime = st.st_mtime;
file->length = st.st_size;
file->uid = st.st_uid;
file->gid = st.st_gid;
---- orig/options.c 2005-02-11 18:21:45
-+++ options.c 2005-02-11 22:48:29
-@@ -131,6 +131,7 @@ char *log_format = NULL;
+--- orig/options.c 2005-02-15 19:27:05
++++ options.c 2005-02-15 19:33:30
+@@ -132,6 +132,7 @@ char *log_format = NULL;
char *password_file = NULL;
char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
char backup_dir_buf[MAXPATHLEN];
int rsync_port = 0;
int compare_dest = 0;
-@@ -146,6 +147,8 @@ int list_only = 0;
+@@ -148,6 +149,8 @@ int list_only = 0;
#define MAX_BATCH_NAME_LEN 256 /* Must be less than MAXPATHLEN-13 */
char *batch_name = NULL;
static int daemon_opt; /* sets am_daemon after option error-reporting */
static int F_option_cnt = 0;
static int modify_window_set;
-@@ -273,6 +276,7 @@ void usage(enum logcode F)
+@@ -275,6 +278,7 @@ void usage(enum logcode F)
rprintf(F," -D, --devices preserve devices (root only)\n");
rprintf(F," -t, --times preserve times\n");
rprintf(F," -O, --omit-dir-times omit directories when preserving times\n");
+ rprintf(F," --chmod=CHMOD change destination permissions\n");
rprintf(F," -S, --sparse handle sparse files efficiently\n");
rprintf(F," -n, --dry-run show what would have been transferred\n");
- rprintf(F," -W, --whole-file copy files whole\n");
-@@ -389,6 +393,7 @@ static struct poptOption long_options[]
+ rprintf(F," -W, --whole-file copy files whole (without rsync algorithm)\n");
+@@ -393,6 +397,7 @@ static struct poptOption long_options[]
{"perms", 'p', POPT_ARG_NONE, &preserve_perms, 0, 0, 0 },
{"owner", 'o', POPT_ARG_NONE, &preserve_uid, 0, 0, 0 },
{"group", 'g', POPT_ARG_NONE, &preserve_gid, 0, 0, 0 },
{"devices", 'D', POPT_ARG_NONE, &preserve_devices, 0, 0, 0 },
{"times", 't', POPT_ARG_NONE, &preserve_times, 0, 0, 0 },
{"omit-dir-times", 'O', POPT_ARG_NONE, &omit_dir_times, 0, 0, 0 },
-@@ -1044,6 +1049,13 @@ int parse_arguments(int *argc, const cha
+@@ -1050,6 +1055,13 @@ int parse_arguments(int *argc, const cha
return 0;
}
+ return 0;
+ }
+
- if (do_progress && !verbose) {
+ if (do_progress && !verbose && !itemize_changes) {
if (refused_verbose) {
create_refuse_error(refused_verbose);
-@@ -1366,6 +1378,11 @@ void server_options(char **args,int *arg
+@@ -1374,6 +1386,11 @@ void server_options(char **args,int *arg
}
}
if (files_from && (!am_sender || remote_filesfrom_file)) {
if (remote_filesfrom_file) {
args[ac++] = "--files-from";
---- orig/rsync.yo 2005-02-11 10:53:15
+--- orig/rsync.yo 2005-02-15 19:27:05
+++ rsync.yo 2005-01-24 01:48:43
@@ -322,6 +322,7 @@ to the detailed description below for a
-D, --devices preserve devices (root only)
+ --chmod=CHMOD change destination permissions
-S, --sparse handle sparse files efficiently
-n, --dry-run show what would have been transferred
- -W, --whole-file copy files whole
-@@ -642,6 +643,14 @@ dit(bf(-O, --omit-dir-times)) This tells
+ -W, --whole-file copy files whole (without rsync algorithm)
+@@ -644,6 +645,14 @@ dit(bf(-O, --omit-dir-times)) This tells
it is preserving modification times (see bf(--times)). If NFS is sharing
the directories on the receiving side, it is a good idea to use bf(-O).