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-04-28 16:26:28
+--- orig/generator.c 2005-05-19 08:52:42
+++ generator.c 2005-03-03 02:59:17
@@ -54,6 +54,7 @@ extern int delay_updates;
extern int update_only;
extern int make_backups;
extern int csum_length;
extern int ignore_times;
-@@ -473,35 +474,42 @@ static void generate_and_send_sums(int f
+@@ -472,35 +473,42 @@ static void generate_and_send_sums(int f
OFF_T offset = 0;
sum_sizes_sqroot(&sum, len);
}
if (mapbuf)
-@@ -1010,6 +1018,9 @@ static void recv_generator(char *fname,
+@@ -1009,6 +1017,9 @@ static void recv_generator(char *fname,
return;
}
if (!compare_dest && fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
-@@ -1185,7 +1196,7 @@ void generate_files(int f_out, struct fi
+@@ -1182,7 +1193,7 @@ void generate_files(int f_out, struct fi
do_delete_pass(flist);
do_progress = 0;
whole_file = 0;
if (verbose >= 2) {
rprintf(FINFO, "delta-transmission %s\n",
-@@ -1242,6 +1253,8 @@ void generate_files(int f_out, struct fi
+@@ -1239,6 +1250,8 @@ void generate_files(int f_out, struct fi
only_existing = max_size = opt_ignore_existing = 0;
update_only = always_checksum = size_only = 0;
ignore_times = 1;
matched(f, s, buf, j, -2);
matched(f, s, buf, len, -1);
}
---- orig/options.c 2005-05-10 15:32:58
+--- orig/options.c 2005-05-19 08:52:42
+++ options.c 2005-03-11 11:21:34
-@@ -39,6 +39,7 @@ int make_backups = 0;
+@@ -38,6 +38,7 @@ int make_backups = 0;
**/
int whole_file = -1;
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");
-@@ -405,6 +408,7 @@ static struct poptOption long_options[]
+@@ -404,6 +407,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 },
{"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 },
-@@ -580,6 +584,8 @@ static void set_refuse_options(char *bp)
+@@ -579,6 +583,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)
-@@ -1130,6 +1136,14 @@ int parse_arguments(int *argc, const cha
+@@ -1126,6 +1132,14 @@ int parse_arguments(int *argc, const cha
bwlimit_writemax = 512;
}
if (delay_updates && !partial_dir)
partial_dir = partialdir_for_delayupdate;
-@@ -1442,7 +1456,9 @@ void server_options(char **args,int *arg
+@@ -1438,7 +1452,9 @@ void server_options(char **args,int *arg
if (opt_ignore_existing && am_sender)
args[ac++] = "--ignore-existing";
continue;
}
---- orig/rsync.yo 2005-05-10 16:14:33
+--- orig/rsync.yo 2005-05-10 23:47:12
+++ 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)
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-04-14 01:53:12
-+++ sender.c 2005-03-16 02:25:18
-@@ -28,6 +28,7 @@ extern int log_format_has_i;
+--- orig/sender.c 2005-05-19 08:52:42
++++ sender.c 2005-05-19 08:53:05
+@@ -27,6 +27,7 @@ extern int log_before_transfer;
+ extern int log_format_has_i;
extern int daemon_log_format_has_i;
extern int csum_length;
- extern int io_error;
+extern int append_mode;
+ extern int io_error;
+ extern int allowed_lull;
extern int protocol_version;
- extern int remove_sent_files;
- extern int updating_basis_file;
-@@ -70,6 +71,13 @@ static struct sum_struct *receive_sums(i
+@@ -72,6 +73,13 @@ static struct sum_struct *receive_sums(i
(double)s->count, (long)s->blength, (long)s->remainder);
}
if (s->count == 0)
return(s);
-@@ -226,6 +234,7 @@ void send_files(struct file_list *flist,
+@@ -231,6 +239,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;
+}
+
+#endif
---- orig/options.c 2005-05-10 15:32:58
-+++ options.c 2005-04-09 18:01:31
+--- orig/options.c 2005-05-19 08:52:42
++++ options.c 2005-05-19 08:55:42
@@ -141,6 +141,7 @@ char *log_format = NULL;
char *password_file = NULL;
char *rsync_path = RSYNC_PATH;
rprintf(F," -z, --compress compress file data during the transfer\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");
-@@ -364,7 +366,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -362,7 +364,7 @@ void usage(enum logcode F)
+
+ 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_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
- OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH,
-- OPT_TIMEOUT, OPT_MAX_SIZE,
-+ OPT_TIMEOUT, OPT_MAX_SIZE, OPT_LINK_BY_HASH,
+- OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
++ OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_LINK_BY_HASH,
+ OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_REFUSED_BASE = 9000};
- static struct poptOption long_options[] = {
-@@ -433,6 +435,7 @@ static struct poptOption long_options[]
+@@ -432,6 +434,7 @@ static struct poptOption long_options[]
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
{"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 },
{"fuzzy", 'y', POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 },
/* TODO: Should this take an optional int giving the compression level? */
{"compress", 'z', POPT_ARG_NONE, &do_compression, 0, 0, 0 },
-@@ -882,6 +885,21 @@ int parse_arguments(int *argc, const cha
+@@ -876,6 +879,21 @@ int parse_arguments(int *argc, const cha
basis_dir[basis_dir_cnt++] = (char *)arg;
break;
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1462,6 +1480,11 @@ void server_options(char **args,int *arg
+@@ -1458,6 +1476,11 @@ void server_options(char **args,int *arg
}
}
---- orig/generator.c 2005-04-28 16:26:28
+--- orig/generator.c 2005-05-19 08:52:42
+++ generator.c 2005-04-28 16:19:24
@@ -58,6 +58,7 @@ extern int make_backups;
extern int csum_length;
extern int size_only;
+extern OFF_T min_size;
extern OFF_T max_size;
- extern int io_timeout;
extern int io_error;
-@@ -837,6 +838,15 @@ static void recv_generator(char *fname,
+ extern int allowed_lull;
+@@ -836,6 +837,15 @@ static void recv_generator(char *fname,
return;
}
if (max_size && file->length > max_size) {
if (verbose > 1) {
if (the_file_list->count == 1)
-@@ -1239,7 +1249,7 @@ void generate_files(int f_out, struct fi
+@@ -1236,7 +1246,7 @@ void generate_files(int f_out, struct fi
phase++;
csum_length = SUM_LENGTH;
update_only = always_checksum = size_only = 0;
ignore_times = 1;
make_backups = 0; /* avoid a duplicate backup for inplace processing */
---- orig/options.c 2005-05-10 15:32:58
-+++ options.c 2005-04-28 16:20:41
+--- orig/options.c 2005-05-19 08:52:42
++++ options.c 2005-05-19 08:57:19
@@ -98,6 +98,7 @@ int only_existing = 0;
int opt_ignore_existing = 0;
int need_messages_from_generator = 0;
rprintf(F," --max-size=SIZE don't transfer any file larger than SIZE\n");
rprintf(F," --partial keep partially transferred files\n");
rprintf(F," --partial-dir=DIR put a partially transferred file into DIR\n");
-@@ -364,7 +366,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -362,7 +364,7 @@ void usage(enum logcode F)
+
+ 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_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
- OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH,
-- OPT_TIMEOUT, OPT_MAX_SIZE,
-+ OPT_TIMEOUT, OPT_MIN_SIZE, OPT_MAX_SIZE,
+- OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
++ OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE,
+ OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_REFUSED_BASE = 9000};
- static struct poptOption long_options[] = {
-@@ -427,6 +429,7 @@ static struct poptOption long_options[]
+@@ -426,6 +428,7 @@ static struct poptOption long_options[]
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
{"block-size", 'B', POPT_ARG_LONG, &block_size, 0, 0, 0 },
{"max-delete", 0, POPT_ARG_INT, &max_delete, 0, 0, 0 },
+ {"min-size", 0, POPT_ARG_STRING, &min_size_arg, OPT_MIN_SIZE, 0, 0 },
{"max-size", 0, POPT_ARG_STRING, &max_size_arg, OPT_MAX_SIZE, 0, 0 },
- {"timeout", 0, POPT_ARG_INT, &io_timeout, OPT_TIMEOUT, 0, 0 },
+ {"timeout", 0, POPT_ARG_INT, &io_timeout, 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
-@@ -835,6 +838,15 @@ int parse_arguments(int *argc, const cha
+@@ -834,6 +837,15 @@ int parse_arguments(int *argc, const cha
read_batch = 1;
break;
case OPT_MAX_SIZE:
if ((max_size = parse_size_arg(max_size_arg)) <= 0) {
snprintf(err_buf, sizeof err_buf,
-@@ -1352,6 +1364,11 @@ void server_options(char **args,int *arg
+@@ -1348,6 +1360,11 @@ void server_options(char **args,int *arg
args[ac++] = arg;
}
if (max_size && am_sender) {
args[ac++] = "--max-size";
args[ac++] = max_size_arg;
---- orig/rsync.yo 2005-05-10 16:14:33
+--- orig/rsync.yo 2005-05-10 23:47:12
+++ rsync.yo 2005-05-06 19:12:35
@@ -342,6 +342,7 @@ to the detailed description below for a
--ignore-errors delete even if there are I/O errors
if (verbose > 3) {
rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): entered\n",
code, safe_fname(file), line);
---- orig/clientserver.c 2005-04-09 17:38:31
+--- orig/clientserver.c 2005-05-19 08:52:42
+++ clientserver.c 2005-04-09 17:39:57
-@@ -45,6 +45,9 @@ extern int select_timeout;
+@@ -44,6 +44,9 @@ extern int io_timeout;
extern int orig_umask;
extern int no_detach;
extern int default_af_hint;
extern char *bind_address;
extern struct filter_list_struct server_filter_list;
extern char *config_file;
-@@ -99,8 +102,18 @@ int start_socket_client(char *host, char
+@@ -98,8 +101,18 @@ int start_socket_client(char *host, char
exit_cleanup(RERR_SOCKETIO);
ret = start_inband_exchange(user, path, fd, fd, argc);
}
int start_inband_exchange(char *user, char *path, int f_in, int f_out,
-@@ -161,6 +174,33 @@ int start_inband_exchange(char *user, ch
+@@ -160,6 +173,33 @@ int start_inband_exchange(char *user, ch
if (verbose > 1)
print_child_argv(sargs);
p = strchr(path,'/');
if (p) *p = 0;
io_printf(f_out, "%s\n", path);
-@@ -189,6 +229,10 @@ int start_inband_exchange(char *user, ch
+@@ -188,6 +228,10 @@ int start_inband_exchange(char *user, ch
* server to terminate the listing of modules.
* We don't want to go on and transfer
* anything; just exit. */
exit(0);
}
-@@ -196,6 +240,10 @@ int start_inband_exchange(char *user, ch
+@@ -195,6 +239,10 @@ int start_inband_exchange(char *user, ch
rprintf(FERROR, "%s\n", line);
/* This is always fatal; the server will now
* close the socket. */
return -1;
}
-@@ -545,6 +593,7 @@ static void send_listing(int fd)
+@@ -541,6 +589,7 @@ static void send_listing(int fd)
io_printf(fd,"@RSYNCD: EXIT\n");
}
/* this is called when a connection is established to a client
and we want to start talking. The setup of the system is done from
here */
-@@ -594,6 +643,9 @@ int start_daemon(int f_in, int f_out)
+@@ -590,6 +639,9 @@ int start_daemon(int f_in, int f_out)
if (protocol_version > remote_protocol)
protocol_version = remote_protocol;
line[0] = 0;
if (!read_line(f_in, line, sizeof line - 1))
return -1;
-@@ -603,6 +655,20 @@ int start_daemon(int f_in, int f_out)
+@@ -599,6 +651,20 @@ int start_daemon(int f_in, int f_out)
return -1;
}
if (*line == '#') {
/* it's some sort of command that I don't understand */
io_printf(f_out, "@ERROR: Unknown command '%s'\n", line);
---- orig/configure.in 2005-04-07 17:04:26
+--- orig/configure.in 2005-05-13 22:24:18
+++ configure.in 2004-07-03 20:22:28
@@ -282,6 +282,21 @@ yes
AC_SEARCH_LIBS(getaddrinfo, inet6)
AC_MSG_CHECKING([whether to call shutdown on all sockets])
case $host_os in
*cygwin* ) AC_MSG_RESULT(yes)
---- orig/options.c 2005-05-10 15:32:58
-+++ options.c 2005-05-03 16:51:16
+--- orig/options.c 2005-05-19 08:52:42
++++ options.c 2005-05-19 08:58:46
@@ -157,6 +157,14 @@ int log_format_has_o_or_i = 0;
int always_checksum = 0;
int list_only = 0;
rprintf(F," --version print version number\n");
rprintf(F," -h, --help show this help screen\n");
-@@ -364,7 +384,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -362,7 +382,7 @@ void usage(enum logcode F)
+
+ 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_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
- OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH,
-- OPT_TIMEOUT, OPT_MAX_SIZE,
-+ OPT_TIMEOUT, OPT_MAX_SIZE, OPT_USE_SSL,
+- OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
++ OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_USE_SSL,
+ OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_REFUSED_BASE = 9000};
- static struct poptOption long_options[] = {
-@@ -465,6 +485,13 @@ static struct poptOption long_options[]
+@@ -464,6 +484,13 @@ static struct poptOption long_options[]
{"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
/* All these options switch us into daemon-mode option-parsing. */
{"config", 0, POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 },
{"daemon", 0, POPT_ARG_NONE, 0, OPT_DAEMON, 0, 0 },
-@@ -882,6 +909,12 @@ int parse_arguments(int *argc, const cha
+@@ -876,6 +903,12 @@ int parse_arguments(int *argc, const cha
basis_dir[basis_dir_cnt++] = (char *)arg;
break;
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1133,6 +1166,17 @@ int parse_arguments(int *argc, const cha
+@@ -1129,6 +1162,17 @@ int parse_arguments(int *argc, const cha
if (delay_updates && !partial_dir)
partial_dir = partialdir_for_delayupdate;
if (inplace) {
#ifdef HAVE_FTRUNCATE
if (partial_dir) {
-@@ -1502,11 +1546,28 @@ char *check_for_hostspec(char *s, char *
+@@ -1498,11 +1542,28 @@ char *check_for_hostspec(char *s, char *
{
char *p;
int not_host;
Do we need configure support for mktime()?
---- orig/io.c 2005-04-07 17:04:26
-+++ io.c 2005-03-05 00:32:06
-@@ -56,6 +56,7 @@ extern int remove_sent_files;
+--- orig/io.c 2005-05-19 08:52:42
++++ io.c 2005-05-19 09:01:27
+@@ -57,6 +57,7 @@ extern int remove_sent_files;
extern int preserve_hard_links;
extern char *filesfrom_host;
extern struct stats stats;
extern struct file_list *the_file_list;
const char phase_unknown[] = "unknown";
-@@ -163,16 +164,24 @@ static void check_timeout(void)
+@@ -165,16 +166,24 @@ static void check_timeout(void)
{
time_t t;
if (!io_timeout || ignore_timeout)
return;
- if (!last_io) {
-- last_io = time(NULL);
-+ last_io = t;
+ if (!last_io_in) {
+- last_io_in = time(NULL);
++ last_io_in = t;
return;
}
- t = time(NULL);
-
- if (t - last_io >= io_timeout) {
+ if (t - last_io_in >= io_timeout) {
if (!am_server && !am_daemon) {
rprintf(FERROR, "io timeout after %d seconds -- exiting\n",
---- orig/options.c 2005-05-10 15:32:58
-+++ options.c 2005-04-09 18:03:53
+--- orig/options.c 2005-05-19 08:52:42
++++ options.c 2005-05-19 09:01:55
@@ -106,6 +106,7 @@ int checksum_seed = 0;
int inplace = 0;
int delay_updates = 0;
rprintf(F," --write-batch=FILE write a batched update to FILE\n");
rprintf(F," --only-write-batch=FILE like --write-batch but w/o updating destination\n");
rprintf(F," --read-batch=FILE read a batched update from FILE\n");
-@@ -365,6 +368,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -364,6 +367,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+ OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
- OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH,
- OPT_TIMEOUT, OPT_MAX_SIZE,
+ OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
+ OPT_STOP_AT, OPT_TIME_LIMIT,
OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -451,6 +455,8 @@ static struct poptOption long_options[]
+@@ -450,6 +454,8 @@ static struct poptOption long_options[]
{"log-format", 0, POPT_ARG_STRING, &log_format, 0, 0, 0 },
{"itemize-changes", 'i', POPT_ARG_NONE, &itemize_changes, 0, 0, 0 },
{"bwlimit", 0, POPT_ARG_INT, &bwlimit, 0, 0, 0 },
{"backup-dir", 0, POPT_ARG_STRING, &backup_dir, 0, 0, 0 },
{"hard-links", 'H', POPT_ARG_NONE, &preserve_hard_links, 0, 0, 0 },
{"read-batch", 0, POPT_ARG_STRING, &batch_name, OPT_READ_BATCH, 0, 0 },
-@@ -882,6 +888,36 @@ int parse_arguments(int *argc, const cha
+@@ -876,6 +882,36 @@ int parse_arguments(int *argc, const cha
basis_dir[basis_dir_cnt++] = (char *)arg;
break;
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1369,6 +1405,15 @@ void server_options(char **args,int *arg
+@@ -1365,6 +1401,15 @@ void server_options(char **args,int *arg
args[ac++] = arg;
}
if (backup_dir) {
args[ac++] = "--backup-dir";
args[ac++] = backup_dir;
---- orig/rsync.yo 2005-05-10 16:14:33
+--- orig/rsync.yo 2005-05-10 23:47:12
+++ rsync.yo 2005-02-01 10:46:35
@@ -379,6 +379,8 @@ to the detailed description below for a
--password-file=FILE read password from FILE