int ignore_times=0;
int delete_mode=0;
int one_file_system=0;
+int remote_version=0;
+int csum_length=SUM_LENGTH;
int am_server = 0;
static int sender = 0;
int ac = *argc;
static char argstr[50];
static char bsize[30];
+ static char slength[30];
int i, x;
args[ac++] = "--server";
sprintf(bsize,"-B%d",block_size);
args[ac++] = bsize;
}
+
+ if (csum_length != SUM_LENGTH) {
+ sprintf(slength,"--csum-length=%d",csum_length);
+ args[ac++] = slength;
+ }
if (delete_mode)
args[ac++] = "--delete";
fprintf(f," --exclude FILE exclude file FILE\n");
fprintf(f," --exclude-from FILE exclude files listed in FILE\n");
fprintf(f," --suffix SUFFIX override backup suffix\n");
+ fprintf(f," --csum-length LENGTH set the checksum length\n");
fprintf(f," --version print version number\n");
fprintf(f,"\n");
}
enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
- OPT_EXCLUDE_FROM,OPT_DELETE,OPT_RSYNC_PATH};
+ OPT_EXCLUDE_FROM,OPT_DELETE,OPT_RSYNC_PATH,OPT_CSUM_LENGTH};
static char *short_options = "oblpguDCtcahvrIxne:B:";
{"exclude", 1, 0, OPT_EXCLUDE},
{"exclude-from",1, 0, OPT_EXCLUDE_FROM},
{"rsync-path", 1, 0, OPT_RSYNC_PATH},
+ {"csum-length", 1, 0, OPT_CSUM_LENGTH},
{"one-file-system",0, 0, 'x'},
{"ignore-times",0, 0, 'I'},
{"help", 0, 0, 'h'},
rsync_path = optarg;
break;
+ case OPT_CSUM_LENGTH:
+ csum_length = atoi(optarg);
+ csum_length = MIN(csum_length,SUM_LENGTH);
+ break;
+
case 'I':
ignore_times = 1;
break;
verbose = MAX(verbose,1);
if (am_server) {
- int version = read_int(STDIN_FILENO);
- if (version < MIN_PROTOCOL_VERSION) {
- fprintf(stderr,"protocol version mismatch %d %d\n",
- version,PROTOCOL_VERSION);
+ remote_version = read_int(STDIN_FILENO);
+ if (remote_version < MIN_PROTOCOL_VERSION ||
+ remote_version > MAX_PROTOCOL_VERSION) {
+ fprintf(stderr,"protocol version mismatch - is your shell clean?\n");
exit(1);
}
write_int(STDOUT_FILENO,PROTOCOL_VERSION);
write_flush(STDOUT_FILENO);
+
+ setup_protocol();
if (sender) {
recv_exclude_list(STDIN_FILENO);
write_int(f_out,PROTOCOL_VERSION);
write_flush(f_out);
{
- int version = read_int(f_in);
- if (version < MIN_PROTOCOL_VERSION) {
- fprintf(stderr,"protocol version mismatch\n");
+ remote_version = read_int(f_in);
+ if (remote_version < MIN_PROTOCOL_VERSION ||
+ remote_version > MAX_PROTOCOL_VERSION) {
+ fprintf(stderr,"protocol version mismatch - is your shell clean?\n");
exit(1);
}
}
+ setup_protocol();
+
if (verbose > 3)
fprintf(stderr,"parent=%d child=%d sender=%d recurse=%d\n",
(int)getpid(),pid,sender,recurse);