improve the autoconf warning for broken readdir
[rsync/rsync.git] / main.c
... / ...
CommitLineData
1/*
2 Copyright (C) Andrew Tridgell 1996
3 Copyright (C) Paul Mackerras 1996
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/
19
20#include "rsync.h"
21
22int verbose = 0;
23int always_checksum = 0;
24time_t starttime;
25int64 total_size = 0;
26int block_size=BLOCK_SIZE;
27
28char *backup_suffix = BACKUP_SUFFIX;
29char *tmpdir = NULL;
30
31static char *rsync_path = RSYNC_NAME;
32
33int make_backups = 0;
34int whole_file = 0;
35int copy_links = 0;
36int preserve_links = 0;
37int preserve_hard_links = 0;
38int preserve_perms = 0;
39int preserve_devices = 0;
40int preserve_uid = 0;
41int preserve_gid = 0;
42int preserve_times = 0;
43int update_only = 0;
44int cvs_exclude = 0;
45int dry_run=0;
46int local_server=0;
47int ignore_times=0;
48int delete_mode=0;
49int one_file_system=0;
50int remote_version=0;
51int sparse_files=0;
52int do_compression=0;
53int am_root=0;
54int orig_umask=0;
55int relative_paths=0;
56int numeric_ids = 0;
57int force_delete = 0;
58int io_timeout = 0;
59int io_error = 0;
60
61extern int csum_length;
62
63int am_server = 0;
64int am_sender;
65int recurse = 0;
66
67static void usage(FILE *f);
68
69static void report(int f)
70{
71 int64 in,out,tsize;
72 time_t t = time(NULL);
73
74 if (!verbose) return;
75
76 if (am_server && am_sender) {
77 write_longint(f,read_total());
78 write_longint(f,write_total());
79 write_longint(f,total_size);
80 write_flush(f);
81 return;
82 }
83
84 if (am_sender) {
85 in = read_total();
86 out = write_total();
87 tsize = total_size;
88 } else {
89 in = read_longint(f);
90 out = read_longint(f);
91 tsize = read_longint(f);
92 }
93
94 printf("wrote %.0f bytes read %.0f bytes %.2f bytes/sec\n",
95 (double)out,(double)in,(in+out)/(0.5 + (t-starttime)));
96 printf("total size is %.0f speedup is %.2f\n",
97 (double)tsize,(1.0*tsize)/(in+out));
98}
99
100
101static void server_options(char **args,int *argc)
102{
103 int ac = *argc;
104 static char argstr[50];
105 static char bsize[30];
106 static char iotime[30];
107 int i, x;
108
109 args[ac++] = "--server";
110
111 if (!am_sender)
112 args[ac++] = "--sender";
113
114 x = 1;
115 argstr[0] = '-';
116 for (i=0;i<verbose;i++)
117 argstr[x++] = 'v';
118 if (make_backups)
119 argstr[x++] = 'b';
120 if (update_only)
121 argstr[x++] = 'u';
122 if (dry_run)
123 argstr[x++] = 'n';
124 if (preserve_links)
125 argstr[x++] = 'l';
126 if (copy_links)
127 argstr[x++] = 'L';
128 if (whole_file)
129 argstr[x++] = 'W';
130 if (preserve_hard_links)
131 argstr[x++] = 'H';
132 if (preserve_uid)
133 argstr[x++] = 'o';
134 if (preserve_gid)
135 argstr[x++] = 'g';
136 if (preserve_devices)
137 argstr[x++] = 'D';
138 if (preserve_times)
139 argstr[x++] = 't';
140 if (preserve_perms)
141 argstr[x++] = 'p';
142 if (recurse)
143 argstr[x++] = 'r';
144 if (always_checksum)
145 argstr[x++] = 'c';
146 if (cvs_exclude)
147 argstr[x++] = 'C';
148 if (ignore_times)
149 argstr[x++] = 'I';
150 if (relative_paths)
151 argstr[x++] = 'R';
152 if (one_file_system)
153 argstr[x++] = 'x';
154 if (sparse_files)
155 argstr[x++] = 'S';
156 if (do_compression)
157 argstr[x++] = 'z';
158 argstr[x] = 0;
159
160 if (x != 1) args[ac++] = argstr;
161
162 if (block_size != BLOCK_SIZE) {
163 sprintf(bsize,"-B%d",block_size);
164 args[ac++] = bsize;
165 }
166
167 if (io_timeout) {
168 sprintf(iotime,"--timeout=%d",io_timeout);
169 args[ac++] = iotime;
170 }
171
172 if (strcmp(backup_suffix, BACKUP_SUFFIX)) {
173 args[ac++] = "--suffix";
174 args[ac++] = backup_suffix;
175 }
176
177 if (delete_mode)
178 args[ac++] = "--delete";
179
180 if (force_delete)
181 args[ac++] = "--force";
182
183 if (numeric_ids)
184 args[ac++] = "--numeric-ids";
185
186 if (tmpdir) {
187 args[ac++] = "--temp-dir";
188 args[ac++] = tmpdir;
189 }
190
191 *argc = ac;
192}
193
194
195
196static int do_cmd(char *cmd,char *machine,char *user,char *path,int *f_in,int *f_out)
197{
198 char *args[100];
199 int i,argc=0, ret;
200 char *tok,*dir=NULL;
201
202 if (!local_server) {
203 if (!cmd)
204 cmd = getenv(RSYNC_RSH_ENV);
205 if (!cmd)
206 cmd = RSYNC_RSH;
207 cmd = strdup(cmd);
208 if (!cmd)
209 goto oom;
210
211 for (tok=strtok(cmd," ");tok;tok=strtok(NULL," ")) {
212 args[argc++] = tok;
213 }
214
215#if HAVE_REMSH
216 /* remsh (on HPUX) takes the arguments the other way around */
217 args[argc++] = machine;
218 if (user) {
219 args[argc++] = "-l";
220 args[argc++] = user;
221 }
222#else
223 if (user) {
224 args[argc++] = "-l";
225 args[argc++] = user;
226 }
227 args[argc++] = machine;
228#endif
229
230 args[argc++] = rsync_path;
231
232 server_options(args,&argc);
233 }
234
235 args[argc++] = ".";
236
237 if (path && *path)
238 args[argc++] = path;
239
240 args[argc] = NULL;
241
242 if (verbose > 3) {
243 fprintf(FINFO,"cmd=");
244 for (i=0;i<argc;i++)
245 fprintf(FINFO,"%s ",args[i]);
246 fprintf(FINFO,"\n");
247 }
248
249 if (local_server) {
250 ret = local_child(argc, args, f_in, f_out);
251 } else {
252 ret = piped_child(args,f_in,f_out);
253 }
254
255 if (dir) free(dir);
256
257 return ret;
258
259oom:
260 out_of_memory("do_cmd");
261 return 0; /* not reached */
262}
263
264
265
266
267static char *get_local_name(struct file_list *flist,char *name)
268{
269 STRUCT_STAT st;
270
271 if (do_stat(name,&st) == 0) {
272 if (S_ISDIR(st.st_mode)) {
273 if (chdir(name) != 0) {
274 fprintf(FERROR,"chdir %s : %s (1)\n",name,strerror(errno));
275 exit_cleanup(1);
276 }
277 return NULL;
278 }
279 if (flist->count > 1) {
280 fprintf(FERROR,"ERROR: destination must be a directory when copying more than 1 file\n");
281 exit_cleanup(1);
282 }
283 return name;
284 }
285
286 if (flist->count == 1)
287 return name;
288
289 if (!name)
290 return NULL;
291
292 if (do_mkdir(name,0777 & ~orig_umask) != 0) {
293 fprintf(FERROR,"mkdir %s : %s (1)\n",name,strerror(errno));
294 exit_cleanup(1);
295 } else {
296 fprintf(FINFO,"created directory %s\n",name);
297 }
298
299 if (chdir(name) != 0) {
300 fprintf(FERROR,"chdir %s : %s (2)\n",name,strerror(errno));
301 exit_cleanup(1);
302 }
303
304 return NULL;
305}
306
307
308
309
310void do_server_sender(int argc,char *argv[])
311{
312 int i;
313 struct file_list *flist;
314 char *dir = argv[0];
315
316 if (verbose > 2)
317 fprintf(FINFO,"server_sender starting pid=%d\n",(int)getpid());
318
319 if (!relative_paths && chdir(dir) != 0) {
320 fprintf(FERROR,"chdir %s: %s (3)\n",dir,strerror(errno));
321 exit_cleanup(1);
322 }
323 argc--;
324 argv++;
325
326 if (strcmp(dir,".")) {
327 int l = strlen(dir);
328 if (strcmp(dir,"/") == 0)
329 l = 0;
330 for (i=0;i<argc;i++)
331 argv[i] += l+1;
332 }
333
334 if (argc == 0 && recurse) {
335 argc=1;
336 argv--;
337 argv[0] = ".";
338 }
339
340
341 flist = send_file_list(STDOUT_FILENO,argc,argv);
342 send_files(flist,STDOUT_FILENO,STDIN_FILENO);
343 report(STDOUT_FILENO);
344 exit_cleanup(0);
345}
346
347
348static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
349{
350 int pid;
351 int status=0;
352 int recv_pipe[2];
353
354 if (preserve_hard_links)
355 init_hard_links(flist);
356
357 if (pipe(recv_pipe) < 0) {
358 fprintf(FERROR,"pipe failed in do_recv\n");
359 exit(1);
360 }
361
362
363 if ((pid=do_fork()) == 0) {
364 recv_files(f_in,flist,local_name,recv_pipe[1]);
365 if (verbose > 2)
366 fprintf(FINFO,"receiver read %ld\n",(long)read_total());
367 exit_cleanup(0);
368 }
369
370 generate_files(f_out,flist,local_name,recv_pipe[0]);
371
372 waitpid(pid, &status, 0);
373
374 return status;
375}
376
377
378void do_server_recv(int argc,char *argv[])
379{
380 int status;
381 struct file_list *flist;
382 char *local_name=NULL;
383 char *dir = NULL;
384
385 if (verbose > 2)
386 fprintf(FINFO,"server_recv(%d) starting pid=%d\n",argc,(int)getpid());
387
388 if (argc > 0) {
389 dir = argv[0];
390 argc--;
391 argv++;
392 if (chdir(dir) != 0) {
393 fprintf(FERROR,"chdir %s : %s (4)\n",
394 dir,strerror(errno));
395 exit_cleanup(1);
396 }
397 }
398
399 if (delete_mode)
400 recv_exclude_list(STDIN_FILENO);
401
402 flist = recv_file_list(STDIN_FILENO);
403 if (!flist || flist->count == 0) {
404 fprintf(FERROR,"nothing to do\n");
405 exit_cleanup(1);
406 }
407
408 if (argc > 0) {
409 if (strcmp(dir,".")) {
410 argv[0] += strlen(dir);
411 if (argv[0][0] == '/') argv[0]++;
412 }
413 local_name = get_local_name(flist,argv[0]);
414 }
415
416 status = do_recv(STDIN_FILENO,STDOUT_FILENO,flist,local_name);
417 exit_cleanup(status);
418}
419
420
421void start_server(int argc, char *argv[])
422{
423 setup_protocol(STDOUT_FILENO,STDIN_FILENO);
424
425 if (am_sender) {
426 recv_exclude_list(STDIN_FILENO);
427 if (cvs_exclude)
428 add_cvs_excludes();
429 do_server_sender(argc,argv);
430 } else {
431 do_server_recv(argc,argv);
432 }
433 exit_cleanup(0);
434}
435
436
437static void usage(FILE *f)
438{
439 fprintf(f,"rsync version %s Copyright Andrew Tridgell and Paul Mackerras\n\n",
440 VERSION);
441 fprintf(f,"Usage:\t%s [options] src user@host:dest\nOR",RSYNC_NAME);
442 fprintf(f,"\t%s [options] user@host:src dest\n\n",RSYNC_NAME);
443 fprintf(f,"Options:\n");
444 fprintf(f,"-v, --verbose increase verbosity\n");
445 fprintf(f,"-c, --checksum always checksum\n");
446 fprintf(f,"-a, --archive archive mode (same as -rlptDog)\n");
447 fprintf(f,"-r, --recursive recurse into directories\n");
448 fprintf(f,"-R, --relative use relative path names\n");
449 fprintf(f,"-b, --backup make backups (default ~ extension)\n");
450 fprintf(f,"-u, --update update only (don't overwrite newer files)\n");
451 fprintf(f,"-l, --links preserve soft links\n");
452 fprintf(f,"-L, --copy-links treat soft links like regular files\n");
453 fprintf(f,"-H, --hard-links preserve hard links\n");
454 fprintf(f,"-p, --perms preserve permissions\n");
455 fprintf(f,"-o, --owner preserve owner (root only)\n");
456 fprintf(f,"-g, --group preserve group\n");
457 fprintf(f,"-D, --devices preserve devices (root only)\n");
458 fprintf(f,"-t, --times preserve times\n");
459 fprintf(f,"-S, --sparse handle sparse files efficiently\n");
460 fprintf(f,"-n, --dry-run show what would have been transferred\n");
461 fprintf(f,"-W, --whole-file copy whole files, no incremental checks\n");
462 fprintf(f,"-x, --one-file-system don't cross filesystem boundaries\n");
463 fprintf(f,"-B, --block-size SIZE checksum blocking size\n");
464 fprintf(f,"-e, --rsh COMMAND specify rsh replacement\n");
465 fprintf(f," --rsync-path PATH specify path to rsync on the remote machine\n");
466 fprintf(f,"-C, --cvs-exclude auto ignore files in the same way CVS does\n");
467 fprintf(f," --delete delete files that don't exist on the sending side\n");
468 fprintf(f," --force force deletion of directories even if not empty\n");
469 fprintf(f," --numeric-ids don't map uid/gid values by user/group name\n");
470 fprintf(f," --timeout TIME set IO timeout in seconds\n");
471 fprintf(f,"-I, --ignore-times don't exclude files that match length and time\n");
472 fprintf(f,"-T --temp-dir DIR create temporary files in directory DIR\n");
473 fprintf(f,"-z, --compress compress file data\n");
474 fprintf(f," --exclude FILE exclude file FILE\n");
475 fprintf(f," --exclude-from FILE exclude files listed in FILE\n");
476 fprintf(f," --suffix SUFFIX override backup suffix\n");
477 fprintf(f," --version print version number\n");
478
479 fprintf(f,"\n");
480 fprintf(f,"the backup suffix defaults to %s\n",BACKUP_SUFFIX);
481 fprintf(f,"the block size defaults to %d\n",BLOCK_SIZE);
482}
483
484enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
485 OPT_EXCLUDE_FROM,OPT_DELETE,OPT_NUMERIC_IDS,OPT_RSYNC_PATH,
486 OPT_FORCE,OPT_TIMEOUT};
487
488static char *short_options = "oblLWHpguDCtcahvrRIxnSe:B:T:z";
489
490static struct option long_options[] = {
491 {"version", 0, 0, OPT_VERSION},
492 {"server", 0, 0, OPT_SERVER},
493 {"sender", 0, 0, OPT_SENDER},
494 {"delete", 0, 0, OPT_DELETE},
495 {"force", 0, 0, OPT_FORCE},
496 {"numeric-ids", 0, 0, OPT_NUMERIC_IDS},
497 {"exclude", 1, 0, OPT_EXCLUDE},
498 {"exclude-from",1, 0, OPT_EXCLUDE_FROM},
499 {"rsync-path", 1, 0, OPT_RSYNC_PATH},
500 {"one-file-system",0, 0, 'x'},
501 {"ignore-times",0, 0, 'I'},
502 {"help", 0, 0, 'h'},
503 {"dry-run", 0, 0, 'n'},
504 {"sparse", 0, 0, 'S'},
505 {"cvs-exclude", 0, 0, 'C'},
506 {"archive", 0, 0, 'a'},
507 {"checksum", 0, 0, 'c'},
508 {"backup", 0, 0, 'b'},
509 {"update", 0, 0, 'u'},
510 {"verbose", 0, 0, 'v'},
511 {"recursive", 0, 0, 'r'},
512 {"relative", 0, 0, 'R'},
513 {"devices", 0, 0, 'D'},
514 {"perms", 0, 0, 'p'},
515 {"links", 0, 0, 'l'},
516 {"copy-links", 0, 0, 'L'},
517 {"whole-file", 0, 0, 'W'},
518 {"hard-links", 0, 0, 'H'},
519 {"owner", 0, 0, 'o'},
520 {"group", 0, 0, 'g'},
521 {"times", 0, 0, 't'},
522 {"rsh", 1, 0, 'e'},
523 {"suffix", 1, 0, OPT_SUFFIX},
524 {"block-size", 1, 0, 'B'},
525 {"timeout", 1, 0, OPT_TIMEOUT},
526 {"temp-dir", 1, 0, 'T'},
527 {"compress", 0, 0, 'z'},
528 {0,0,0,0}};
529
530RETSIGTYPE sigusr1_handler(int val) {
531 exit_cleanup(1);
532}
533
534int main(int argc,char *argv[])
535{
536 int pid, status = 0, status2 = 0;
537 int opt;
538 int option_index;
539 char *shell_cmd = NULL;
540 char *shell_machine = NULL;
541 char *shell_path = NULL;
542 char *shell_user = NULL;
543 char *p;
544 int f_in,f_out;
545 struct file_list *flist;
546 char *local_name = NULL;
547
548 signal(SIGUSR1, sigusr1_handler);
549
550 starttime = time(NULL);
551 am_root = (getuid() == 0);
552
553 /* we set a 0 umask so that correct file permissions can be
554 carried across */
555 orig_umask = (int)umask(0);
556
557 while ((opt = getopt_long(argc, argv,
558 short_options, long_options, &option_index))
559 != -1) {
560 switch (opt)
561 {
562 case OPT_VERSION:
563 printf("rsync version %s protocol version %d\n",
564 VERSION,PROTOCOL_VERSION);
565 exit_cleanup(0);
566
567 case OPT_SUFFIX:
568 backup_suffix = optarg;
569 break;
570
571 case OPT_RSYNC_PATH:
572 rsync_path = optarg;
573 break;
574
575 case 'I':
576 ignore_times = 1;
577 break;
578
579 case 'x':
580 one_file_system=1;
581 break;
582
583 case OPT_DELETE:
584 delete_mode = 1;
585 break;
586
587 case OPT_FORCE:
588 force_delete = 1;
589 break;
590
591 case OPT_NUMERIC_IDS:
592 numeric_ids = 1;
593 break;
594
595 case OPT_EXCLUDE:
596 add_exclude(optarg);
597 break;
598
599 case OPT_EXCLUDE_FROM:
600 add_exclude_file(optarg,1);
601 break;
602
603 case 'h':
604 usage(FINFO);
605 exit_cleanup(0);
606
607 case 'b':
608 make_backups=1;
609 break;
610
611 case 'n':
612 dry_run=1;
613 break;
614
615 case 'S':
616 sparse_files=1;
617 break;
618
619 case 'C':
620 cvs_exclude=1;
621 break;
622
623 case 'u':
624 update_only=1;
625 break;
626
627 case 'l':
628 preserve_links=1;
629 break;
630
631 case 'L':
632 copy_links=1;
633 break;
634
635 case 'W':
636 whole_file=1;
637 break;
638
639 case 'H':
640#if SUPPORT_HARD_LINKS
641 preserve_hard_links=1;
642#else
643 fprintf(FERROR,"ERROR: hard links not supported on this platform\n");
644 exit_cleanup(1);
645#endif
646 break;
647
648 case 'p':
649 preserve_perms=1;
650 break;
651
652 case 'o':
653 preserve_uid=1;
654 break;
655
656 case 'g':
657 preserve_gid=1;
658 break;
659
660 case 'D':
661 preserve_devices=1;
662 break;
663
664 case 't':
665 preserve_times=1;
666 break;
667
668 case 'c':
669 always_checksum=1;
670 break;
671
672 case 'v':
673 verbose++;
674 break;
675
676 case 'a':
677 recurse=1;
678#if SUPPORT_LINKS
679 preserve_links=1;
680#endif
681 preserve_perms=1;
682 preserve_times=1;
683 preserve_gid=1;
684 if (am_root) {
685 preserve_devices=1;
686 preserve_uid=1;
687 }
688 break;
689
690 case OPT_SERVER:
691 am_server = 1;
692 break;
693
694 case OPT_SENDER:
695 if (!am_server) {
696 usage(FERROR);
697 exit_cleanup(1);
698 }
699 am_sender = 1;
700 break;
701
702 case 'r':
703 recurse = 1;
704 break;
705
706 case 'R':
707 relative_paths = 1;
708 break;
709
710 case 'e':
711 shell_cmd = optarg;
712 break;
713
714 case 'B':
715 block_size = atoi(optarg);
716 break;
717
718 case OPT_TIMEOUT:
719 io_timeout = atoi(optarg);
720 break;
721
722 case 'T':
723 tmpdir = optarg;
724 break;
725
726 case 'z':
727 do_compression = 1;
728 break;
729
730 default:
731 /* fprintf(FERROR,"bad option -%c\n",opt); */
732 exit_cleanup(1);
733 }
734 }
735
736 while (optind--) {
737 argc--;
738 argv++;
739 }
740
741 signal(SIGCHLD,SIG_IGN);
742 signal(SIGINT,SIGNAL_CAST sig_int);
743 signal(SIGPIPE,SIGNAL_CAST sig_int);
744 signal(SIGHUP,SIGNAL_CAST sig_int);
745
746 if (dry_run)
747 verbose = MAX(verbose,1);
748
749#ifndef SUPPORT_LINKS
750 if (!am_server && preserve_links) {
751 fprintf(FERROR,"ERROR: symbolic links not supported\n");
752 exit_cleanup(1);
753 }
754#endif
755
756 if (am_server) {
757 start_server(argc, argv);
758 }
759
760 if (argc < 2) {
761 usage(FERROR);
762 exit_cleanup(1);
763 }
764
765 p = strchr(argv[0],':');
766
767 if (p) {
768 am_sender = 0;
769 *p = 0;
770 shell_machine = argv[0];
771 shell_path = p+1;
772 argc--;
773 argv++;
774 } else {
775 am_sender = 1;
776
777 p = strchr(argv[argc-1],':');
778 if (!p) {
779 local_server = 1;
780 }
781
782 if (local_server) {
783 shell_machine = NULL;
784 shell_path = argv[argc-1];
785 } else {
786 *p = 0;
787 shell_machine = argv[argc-1];
788 shell_path = p+1;
789 }
790 argc--;
791 }
792
793 if (shell_machine) {
794 p = strchr(shell_machine,'@');
795 if (p) {
796 *p = 0;
797 shell_user = shell_machine;
798 shell_machine = p+1;
799 }
800 }
801
802 if (verbose > 3) {
803 fprintf(FINFO,"cmd=%s machine=%s user=%s path=%s\n",
804 shell_cmd?shell_cmd:"",
805 shell_machine?shell_machine:"",
806 shell_user?shell_user:"",
807 shell_path?shell_path:"");
808 }
809
810 if (!am_sender && argc != 1) {
811 usage(FERROR);
812 exit_cleanup(1);
813 }
814
815 pid = do_cmd(shell_cmd,shell_machine,shell_user,shell_path,&f_in,&f_out);
816
817 setup_protocol(f_out,f_in);
818
819#if HAVE_SETLINEBUF
820 setlinebuf(FINFO);
821 setlinebuf(FERROR);
822#endif
823
824 if (verbose > 3)
825 fprintf(FINFO,"parent=%d child=%d sender=%d recurse=%d\n",
826 (int)getpid(),pid,am_sender,recurse);
827
828 if (am_sender) {
829 if (cvs_exclude)
830 add_cvs_excludes();
831 if (delete_mode)
832 send_exclude_list(f_out);
833 flist = send_file_list(f_out,argc,argv);
834 if (verbose > 3)
835 fprintf(FINFO,"file list sent\n");
836 send_files(flist,f_out,f_in);
837 if (verbose > 3)
838 fprintf(FINFO,"waiting on %d\n",pid);
839 waitpid(pid, &status, 0);
840 report(-1);
841 exit_cleanup(status);
842 }
843
844 send_exclude_list(f_out);
845
846 flist = recv_file_list(f_in);
847 if (!flist || flist->count == 0) {
848 fprintf(FINFO,"nothing to do\n");
849 exit_cleanup(0);
850 }
851
852 local_name = get_local_name(flist,argv[0]);
853
854 status2 = do_recv(f_in,f_out,flist,local_name);
855
856 report(f_in);
857
858 waitpid(pid, &status, 0);
859
860 return status | status2;
861}
862