Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added in-stream deflate compression for file reconstruction instructions.
[rsync/rsync.git]
/
main.c
diff --git
a/main.c
b/main.c
index
3efde6d
..
7cef434
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-93,7
+93,6
@@
static void server_options(char **args,int *argc)
int ac = *argc;
static char argstr[50];
static char bsize[30];
int ac = *argc;
static char argstr[50];
static char bsize[30];
- static char slength[30];
int i, x;
args[ac++] = "--server";
int i, x;
args[ac++] = "--server";
@@
-137,6
+136,8
@@
static void server_options(char **args,int *argc)
argstr[x++] = 'x';
if (sparse_files)
argstr[x++] = 'S';
argstr[x++] = 'x';
if (sparse_files)
argstr[x++] = 'S';
+ if (do_compression)
+ argstr[x++] = 'z';
argstr[x] = 0;
if (x != 1) args[ac++] = argstr;
argstr[x] = 0;
if (x != 1) args[ac++] = argstr;
@@
-146,11
+147,6
@@
static void server_options(char **args,int *argc)
args[ac++] = bsize;
}
args[ac++] = bsize;
}
- if (csum_length != SUM_LENGTH) {
- sprintf(slength,"--csum-length=%d",csum_length);
- args[ac++] = slength;
- }
-
if (delete_mode)
args[ac++] = "--delete";
if (delete_mode)
args[ac++] = "--delete";
@@
-306,12
+302,19
@@
static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
{
int pid;
int status=0;
{
int pid;
int status=0;
+ int recv_pipe[2];
if (preserve_hard_links)
init_hard_links(flist);
if (preserve_hard_links)
init_hard_links(flist);
+ if (pipe(recv_pipe) < 0) {
+ fprintf(FERROR,"pipe failed in do_recv\n");
+ exit(1);
+ }
+
+
if ((pid=fork()) == 0) {
if ((pid=fork()) == 0) {
- recv_files(f_in,flist,local_name);
+ recv_files(f_in,flist,local_name
,recv_pipe[1]
);
if (preserve_hard_links)
do_hard_links(flist);
if (verbose > 2)
if (preserve_hard_links)
do_hard_links(flist);
if (verbose > 2)
@@
-319,7
+322,7
@@
static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
exit_cleanup(0);
}
exit_cleanup(0);
}
- generate_files(f_out,flist,local_name);
+ generate_files(f_out,flist,local_name
,recv_pipe[0]
);
waitpid(pid, &status, 0);
waitpid(pid, &status, 0);
@@
-398,6
+401,7
@@
static void usage(FILE *f)
fprintf(f,"-C, --cvs-exclude auto ignore files in the same way CVS does\n");
fprintf(f," --delete delete files that don't exist on the sending side\n");
fprintf(f,"-I, --ignore-times don't exclude files that match length and time\n");
fprintf(f,"-C, --cvs-exclude auto ignore files in the same way CVS does\n");
fprintf(f," --delete delete files that don't exist on the sending side\n");
fprintf(f,"-I, --ignore-times don't exclude files that match length and time\n");
+ fprintf(f,"-z, --compress compress file data\n");
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," --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");
@@
-410,9
+414,9
@@
static void usage(FILE *f)
}
enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
}
enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
- OPT_EXCLUDE_FROM,OPT_DELETE,OPT_RSYNC_PATH
,OPT_CSUM_LENGTH
};
+ OPT_EXCLUDE_FROM,OPT_DELETE,OPT_RSYNC_PATH};
-static char *short_options = "oblHpguDCtcahvrIxnSe:B:";
+static char *short_options = "oblHpguDCtcahvrIxnSe:B:
z
";
static struct option long_options[] = {
{"version", 0, 0, OPT_VERSION},
static struct option long_options[] = {
{"version", 0, 0, OPT_VERSION},
@@
-422,7
+426,6
@@
static struct option long_options[] = {
{"exclude", 1, 0, OPT_EXCLUDE},
{"exclude-from",1, 0, OPT_EXCLUDE_FROM},
{"rsync-path", 1, 0, OPT_RSYNC_PATH},
{"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'},
{"one-file-system",0, 0, 'x'},
{"ignore-times",0, 0, 'I'},
{"help", 0, 0, 'h'},
@@
-445,6
+448,7
@@
static struct option long_options[] = {
{"rsh", 1, 0, 'e'},
{"suffix", 1, 0, OPT_SUFFIX},
{"block-size", 1, 0, 'B'},
{"rsh", 1, 0, 'e'},
{"suffix", 1, 0, OPT_SUFFIX},
{"block-size", 1, 0, 'B'},
+ {"compress", 0, 0, 'z'},
{0,0,0,0}};
int main(int argc,char *argv[])
{0,0,0,0}};
int main(int argc,char *argv[])
@@
-463,8
+467,6
@@
int main(int argc,char *argv[])
starttime = time(NULL);
starttime = time(NULL);
- checksum_init();
-
while ((opt = getopt_long(argc, argv,
short_options, long_options, &option_index))
!= -1) {
while ((opt = getopt_long(argc, argv,
short_options, long_options, &option_index))
!= -1) {
@@
-483,11
+485,6
@@
int main(int argc,char *argv[])
rsync_path = optarg;
break;
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;
case 'I':
ignore_times = 1;
break;
@@
-620,8
+617,12
@@
int main(int argc,char *argv[])
block_size = atoi(optarg);
break;
block_size = atoi(optarg);
break;
+ case 'z':
+ do_compression = 1;
+ break;
+
default:
default:
- fprintf(FERROR,"bad option -%c\n",opt);
+ /* fprintf(FERROR,"bad option -%c\n",opt); */
exit_cleanup(1);
}
}
exit_cleanup(1);
}
}