- hard links
[rsync/rsync.git] / main.c
CommitLineData
c627d613
AT
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;
25off_t total_size = 0;
26int block_size=BLOCK_SIZE;
27
28char *backup_suffix = BACKUP_SUFFIX;
29
30static char *rsync_path = RSYNC_NAME;
31
32int make_backups = 0;
33int preserve_links = 0;
dc5ddbcc 34int preserve_hard_links = 0;
c627d613
AT
35int preserve_perms = 0;
36int preserve_devices = 0;
37int preserve_uid = 0;
38int preserve_gid = 0;
39int preserve_times = 0;
40int update_only = 0;
41int cvs_exclude = 0;
42int dry_run=0;
43int local_server=0;
44int ignore_times=0;
45int delete_mode=0;
46int one_file_system=0;
4fe159a8 47int remote_version=0;
dc5ddbcc 48int sparse_files=0;
34ccb63e 49extern int csum_length;
c627d613
AT
50
51int am_server = 0;
52static int sender = 0;
53int recurse = 0;
54
55static void usage(FILE *f);
56
57static void report(int f)
58{
59 int in,out,tsize;
60 time_t t = time(NULL);
61
62 if (!verbose) return;
63
64 if (am_server && sender) {
65 write_int(f,read_total());
66 write_int(f,write_total());
67 write_int(f,total_size);
68 write_flush(f);
69 return;
70 }
71
72 if (sender) {
73 in = read_total();
74 out = write_total();
75 tsize = (int)total_size;
76 } else {
77 in = read_int(f);
78 out = read_int(f);
79 tsize = read_int(f);
80 }
81
82 printf("wrote %d bytes read %d bytes %g bytes/sec\n",
83 out,in,(in+out)/(0.5 + (t-starttime)));
84 printf("total size is %d speedup is %g\n",
85 tsize,(1.0*tsize)/(in+out));
86}
87
88
89static void server_options(char **args,int *argc)
90{
91 int ac = *argc;
92 static char argstr[50];
93 static char bsize[30];
43a481dc 94 static char slength[30];
c627d613
AT
95 int i, x;
96
97 args[ac++] = "--server";
98
99 if (!sender)
100 args[ac++] = "--sender";
101
102 x = 1;
103 argstr[0] = '-';
104 for (i=0;i<verbose;i++)
105 argstr[x++] = 'v';
106 if (make_backups)
107 argstr[x++] = 'b';
108 if (update_only)
109 argstr[x++] = 'u';
110 if (dry_run)
111 argstr[x++] = 'n';
112 if (preserve_links)
113 argstr[x++] = 'l';
dc5ddbcc
AT
114 if (preserve_hard_links)
115 argstr[x++] = 'H';
c627d613
AT
116 if (preserve_uid)
117 argstr[x++] = 'o';
118 if (preserve_gid)
119 argstr[x++] = 'g';
120 if (preserve_devices)
121 argstr[x++] = 'D';
122 if (preserve_times)
123 argstr[x++] = 't';
124 if (preserve_perms)
125 argstr[x++] = 'p';
126 if (recurse)
127 argstr[x++] = 'r';
128 if (always_checksum)
129 argstr[x++] = 'c';
130 if (cvs_exclude)
131 argstr[x++] = 'C';
132 if (ignore_times)
133 argstr[x++] = 'I';
134 if (one_file_system)
135 argstr[x++] = 'x';
dc5ddbcc
AT
136 if (sparse_files)
137 argstr[x++] = 'S';
c627d613
AT
138 argstr[x] = 0;
139
140 if (x != 1) args[ac++] = argstr;
141
142 if (block_size != BLOCK_SIZE) {
143 sprintf(bsize,"-B%d",block_size);
144 args[ac++] = bsize;
145 }
43a481dc
AT
146
147 if (csum_length != SUM_LENGTH) {
148 sprintf(slength,"--csum-length=%d",csum_length);
149 args[ac++] = slength;
150 }
c627d613
AT
151
152 if (delete_mode)
153 args[ac++] = "--delete";
154
155 *argc = ac;
156}
157
158
159
160int do_cmd(char *cmd,char *machine,char *user,char *path,int *f_in,int *f_out)
161{
162 char *args[100];
163 int i,argc=0;
164 char *tok,*p;
165
166 if (!local_server) {
167 if (!cmd)
168 cmd = getenv(RSYNC_RSH_ENV);
169 if (!cmd)
170 cmd = RSYNC_RSH;
171 cmd = strdup(cmd);
172 if (!cmd)
173 goto oom;
174
175 for (tok=strtok(cmd," ");tok;tok=strtok(NULL," ")) {
176 args[argc++] = tok;
177 }
178
179 if (user) {
180 args[argc++] = "-l";
181 args[argc++] = user;
182 }
183 args[argc++] = machine;
184 }
185
186 args[argc++] = rsync_path;
187
188 server_options(args,&argc);
189
190 if (path && *path) {
191 char *dir = strdup(path);
192 p = strrchr(dir,'/');
193 if (p) {
194 *p = 0;
195 args[argc++] = dir;
196 p++;
197 } else {
198 args[argc++] = ".";
199 p = dir;
200 }
201 if (p[0])
202 args[argc++] = path;
203 }
204
205 args[argc] = NULL;
206
207 if (verbose > 3) {
dc5ddbcc 208 fprintf(FERROR,"cmd=");
c627d613 209 for (i=0;i<argc;i++)
dc5ddbcc
AT
210 fprintf(FERROR,"%s ",args[i]);
211 fprintf(FERROR,"\n");
c627d613
AT
212 }
213
214 return piped_child(args,f_in,f_out);
215
216oom:
217 out_of_memory("do_cmd");
218 return 0; /* not reached */
219}
220
221
222
223
224static char *get_local_name(struct file_list *flist,char *name)
225{
226 struct stat st;
227
228 if (stat(name,&st) == 0) {
229 if (S_ISDIR(st.st_mode)) {
230 if (chdir(name) != 0) {
dc5ddbcc 231 fprintf(FERROR,"chdir %s : %s\n",name,strerror(errno));
34ccb63e 232 exit_cleanup(1);
c627d613
AT
233 }
234 return NULL;
235 }
236 if (flist->count > 1) {
dc5ddbcc 237 fprintf(FERROR,"ERROR: destination must be a directory when copying more than 1 file\n");
34ccb63e 238 exit_cleanup(1);
c627d613
AT
239 }
240 return name;
241 }
242
243 if (flist->count == 1)
244 return name;
245
246 if (!name)
247 return NULL;
248
249 if (mkdir(name,0777) != 0) {
dc5ddbcc 250 fprintf(FERROR,"mkdir %s : %s\n",name,strerror(errno));
34ccb63e 251 exit_cleanup(1);
94481d91 252 } else {
dc5ddbcc 253 fprintf(FINFO,"created directory %s\n",name);
c627d613
AT
254 }
255
256 if (chdir(name) != 0) {
dc5ddbcc 257 fprintf(FERROR,"chdir %s : %s\n",name,strerror(errno));
34ccb63e 258 exit_cleanup(1);
c627d613
AT
259 }
260
261 return NULL;
262}
263
264
265
266
267void do_server_sender(int argc,char *argv[])
268{
269 int i;
270 char *dir = argv[0];
271 struct file_list *flist;
272
273 if (verbose > 2)
dc5ddbcc 274 fprintf(FERROR,"server_sender starting pid=%d\n",(int)getpid());
c627d613
AT
275
276 if (chdir(dir) != 0) {
dc5ddbcc 277 fprintf(FERROR,"chdir %s: %s\n",dir,strerror(errno));
34ccb63e 278 exit_cleanup(1);
c627d613
AT
279 }
280 argc--;
281 argv++;
282
283 if (strcmp(dir,".")) {
284 int l = strlen(dir);
285 for (i=0;i<argc;i++)
286 argv[i] += l+1;
287 }
288
289 if (argc == 0 && recurse) {
290 argc=1;
291 argv--;
292 argv[0] = ".";
293 }
294
295
296 flist = send_file_list(STDOUT_FILENO,recurse,argc,argv);
297 send_files(flist,STDOUT_FILENO,STDIN_FILENO);
298 report(STDOUT_FILENO);
34ccb63e 299 exit_cleanup(0);
c627d613
AT
300}
301
302
dc5ddbcc
AT
303static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
304{
305 int pid;
306 int status=0;
307
308 if (preserve_hard_links)
309 init_hard_links(flist);
310
311 if ((pid=fork()) == 0) {
312 recv_files(f_in,flist,local_name);
313 if (preserve_hard_links)
314 do_hard_links(flist);
315 if (verbose > 2)
316 fprintf(FERROR,"receiver read %d\n",read_total());
317 exit_cleanup(0);
318 }
319
320 generate_files(f_out,flist,local_name);
321
322 waitpid(pid, &status, 0);
323
324 return status;
325}
326
c627d613
AT
327
328void do_server_recv(int argc,char *argv[])
329{
dc5ddbcc 330 int status;
c627d613
AT
331 char *dir = NULL;
332 struct file_list *flist;
333 char *local_name=NULL;
334
335 if (verbose > 2)
dc5ddbcc 336 fprintf(FERROR,"server_recv(%d) starting pid=%d\n",argc,(int)getpid());
c627d613
AT
337
338 if (argc > 0) {
339 dir = argv[0];
340 argc--;
341 argv++;
342 if (chdir(dir) != 0) {
dc5ddbcc 343 fprintf(FERROR,"chdir %s : %s\n",dir,strerror(errno));
34ccb63e 344 exit_cleanup(1);
c627d613
AT
345 }
346 }
347
348 if (delete_mode)
349 recv_exclude_list(STDIN_FILENO);
350
351 flist = recv_file_list(STDIN_FILENO);
352 if (!flist || flist->count == 0) {
dc5ddbcc 353 fprintf(FERROR,"nothing to do\n");
34ccb63e 354 exit_cleanup(1);
c627d613
AT
355 }
356
357 if (argc > 0) {
358 if (strcmp(dir,".")) {
359 argv[0] += strlen(dir);
360 if (argv[0][0] == '/') argv[0]++;
361 }
362 local_name = get_local_name(flist,argv[0]);
363 }
364
dc5ddbcc 365 status = do_recv(STDIN_FILENO,STDOUT_FILENO,flist,local_name);
34ccb63e 366 exit_cleanup(status);
c627d613
AT
367}
368
369
370static void usage(FILE *f)
371{
372 fprintf(f,"rsync version %s Copyright Andrew Tridgell and Paul Mackerras\n\n",
373 VERSION);
374 fprintf(f,"Usage:\t%s [options] src user@host:dest\nOR",RSYNC_NAME);
375 fprintf(f,"\t%s [options] user@host:src dest\n\n",RSYNC_NAME);
376 fprintf(f,"Options:\n");
377 fprintf(f,"-v, --verbose increase verbosity\n");
378 fprintf(f,"-c, --checksum always checksum\n");
379 fprintf(f,"-a, --archive archive mode (same as -rlptDog)\n");
380 fprintf(f,"-r, --recursive recurse into directories\n");
381 fprintf(f,"-b, --backup make backups (default ~ extension)\n");
382 fprintf(f,"-u, --update update only (don't overwrite newer files)\n");
383 fprintf(f,"-l, --links preserve soft links\n");
dc5ddbcc 384 fprintf(f,"-H, --hard-links preserve hard links\n");
c627d613
AT
385 fprintf(f,"-p, --perms preserve permissions\n");
386 fprintf(f,"-o, --owner preserve owner (root only)\n");
387 fprintf(f,"-g, --group preserve group\n");
388 fprintf(f,"-D, --devices preserve devices (root only)\n");
389 fprintf(f,"-t, --times preserve times\n");
dc5ddbcc 390 fprintf(f,"-S, --sparse handle sparse files efficiently\n");
c627d613
AT
391 fprintf(f,"-n, --dry-run show what would have been transferred\n");
392 fprintf(f,"-x, --one-file-system don't cross filesystem boundaries\n");
393 fprintf(f,"-B, --block-size SIZE checksum blocking size\n");
394 fprintf(f,"-e, --rsh COMMAND specify rsh replacement\n");
395 fprintf(f," --rsync-path PATH specify path to rsync on the remote machine\n");
396 fprintf(f,"-C, --cvs-exclude auto ignore files in the same way CVS does\n");
397 fprintf(f," --delete delete files that don't exist on the sending side\n");
398 fprintf(f,"-I, --ignore-times don't exclude files that match length and time\n");
399 fprintf(f," --exclude FILE exclude file FILE\n");
400 fprintf(f," --exclude-from FILE exclude files listed in FILE\n");
401 fprintf(f," --suffix SUFFIX override backup suffix\n");
43a481dc 402 fprintf(f," --csum-length LENGTH set the checksum length\n");
c627d613
AT
403 fprintf(f," --version print version number\n");
404
405 fprintf(f,"\n");
406 fprintf(f,"the backup suffix defaults to %s\n",BACKUP_SUFFIX);
407 fprintf(f,"the block size defaults to %d\n",BLOCK_SIZE);
408}
409
410enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
43a481dc 411 OPT_EXCLUDE_FROM,OPT_DELETE,OPT_RSYNC_PATH,OPT_CSUM_LENGTH};
c627d613 412
dc5ddbcc 413static char *short_options = "oblHpguDCtcahvrIxnSe:B:";
c627d613
AT
414
415static struct option long_options[] = {
416 {"version", 0, 0, OPT_VERSION},
417 {"server", 0, 0, OPT_SERVER},
418 {"sender", 0, 0, OPT_SENDER},
419 {"delete", 0, 0, OPT_DELETE},
420 {"exclude", 1, 0, OPT_EXCLUDE},
421 {"exclude-from",1, 0, OPT_EXCLUDE_FROM},
422 {"rsync-path", 1, 0, OPT_RSYNC_PATH},
43a481dc 423 {"csum-length", 1, 0, OPT_CSUM_LENGTH},
c627d613
AT
424 {"one-file-system",0, 0, 'x'},
425 {"ignore-times",0, 0, 'I'},
426 {"help", 0, 0, 'h'},
427 {"dry-run", 0, 0, 'n'},
dc5ddbcc 428 {"sparse", 0, 0, 'S'},
c627d613
AT
429 {"cvs-exclude", 0, 0, 'C'},
430 {"archive", 0, 0, 'a'},
431 {"checksum", 0, 0, 'c'},
432 {"backup", 0, 0, 'b'},
433 {"update", 0, 0, 'u'},
434 {"verbose", 0, 0, 'v'},
435 {"recursive", 0, 0, 'r'},
436 {"devices", 0, 0, 'D'},
437 {"perms", 0, 0, 'p'},
438 {"links", 0, 0, 'l'},
dc5ddbcc 439 {"hard-links", 0, 0, 'H'},
c627d613
AT
440 {"owner", 0, 0, 'o'},
441 {"group", 0, 0, 'g'},
442 {"times", 0, 0, 't'},
443 {"rsh", 1, 0, 'e'},
444 {"suffix", 1, 0, OPT_SUFFIX},
445 {"block-size", 1, 0, 'B'},
446 {0,0,0,0}};
447
448int main(int argc,char *argv[])
449{
dc5ddbcc 450 int pid, status, status2;
c627d613
AT
451 int opt;
452 int option_index;
453 char *shell_cmd = NULL;
454 char *shell_machine = NULL;
455 char *shell_path = NULL;
456 char *shell_user = NULL;
457 char *p;
458 int f_in,f_out;
459 struct file_list *flist;
460 char *local_name = NULL;
461
462 starttime = time(NULL);
463
34ccb63e
AT
464 checksum_init();
465
c627d613
AT
466 while ((opt = getopt_long(argc, argv,
467 short_options, long_options, &option_index))
468 != -1) {
469 switch (opt)
470 {
471 case OPT_VERSION:
472 printf("rsync version %s protocol version %d\n",
473 VERSION,PROTOCOL_VERSION);
34ccb63e 474 exit_cleanup(0);
c627d613
AT
475
476 case OPT_SUFFIX:
477 backup_suffix = optarg;
478 break;
479
480 case OPT_RSYNC_PATH:
481 rsync_path = optarg;
482 break;
483
43a481dc
AT
484 case OPT_CSUM_LENGTH:
485 csum_length = atoi(optarg);
486 csum_length = MIN(csum_length,SUM_LENGTH);
487 break;
488
c627d613
AT
489 case 'I':
490 ignore_times = 1;
491 break;
492
493 case 'x':
494 one_file_system=1;
495 break;
496
497 case OPT_DELETE:
498 delete_mode = 1;
499 break;
500
501 case OPT_EXCLUDE:
502 add_exclude(optarg);
503 break;
504
505 case OPT_EXCLUDE_FROM:
506 add_exclude_file(optarg,1);
507 break;
508
509 case 'h':
dc5ddbcc 510 usage(FINFO);
34ccb63e 511 exit_cleanup(0);
c627d613
AT
512
513 case 'b':
514 make_backups=1;
515 break;
516
517 case 'n':
518 dry_run=1;
519 break;
520
dc5ddbcc
AT
521 case 'S':
522 sparse_files=1;
523 break;
524
c627d613
AT
525 case 'C':
526 cvs_exclude=1;
527 break;
528
529 case 'u':
530 update_only=1;
531 break;
532
c627d613 533 case 'l':
dc5ddbcc 534#if SUPPORT_LINKS
c627d613 535 preserve_links=1;
dc5ddbcc 536#endif
c627d613 537 break;
dc5ddbcc
AT
538
539 case 'H':
540#if SUPPORT_HARD_LINKS
541 preserve_hard_links=1;
c627d613 542#endif
dc5ddbcc 543 break;
c627d613
AT
544
545 case 'p':
546 preserve_perms=1;
547 break;
548
549 case 'o':
550 if (getuid() == 0) {
551 preserve_uid=1;
552 } else {
dc5ddbcc 553 fprintf(FERROR,"-o only allowed for root\n");
34ccb63e 554 exit_cleanup(1);
c627d613
AT
555 }
556 break;
557
558 case 'g':
559 preserve_gid=1;
560 break;
561
562 case 'D':
563 if (getuid() == 0) {
564 preserve_devices=1;
565 } else {
dc5ddbcc 566 fprintf(FERROR,"-D only allowed for root\n");
34ccb63e 567 exit_cleanup(1);
c627d613
AT
568 }
569 break;
570
571 case 't':
572 preserve_times=1;
573 break;
574
575 case 'c':
576 always_checksum=1;
577 break;
578
579 case 'v':
580 verbose++;
581 break;
582
583 case 'a':
584 recurse=1;
585#if SUPPORT_LINKS
586 preserve_links=1;
587#endif
588 preserve_perms=1;
589 preserve_times=1;
590 preserve_gid=1;
591 if (getuid() == 0) {
592 preserve_devices=1;
593 preserve_uid=1;
594 }
595 break;
596
597 case OPT_SERVER:
598 am_server = 1;
599 break;
600
601 case OPT_SENDER:
602 if (!am_server) {
dc5ddbcc 603 usage(FERROR);
34ccb63e 604 exit_cleanup(1);
c627d613
AT
605 }
606 sender = 1;
607 break;
608
609 case 'r':
610 recurse = 1;
611 break;
612
613 case 'e':
614 shell_cmd = optarg;
615 break;
616
617 case 'B':
618 block_size = atoi(optarg);
619 break;
620
621 default:
dc5ddbcc 622 fprintf(FERROR,"bad option -%c\n",opt);
34ccb63e 623 exit_cleanup(1);
c627d613
AT
624 }
625 }
626
627 while (optind--) {
628 argc--;
629 argv++;
630 }
631
6b83141d
AT
632 signal(SIGCHLD,SIG_IGN);
633 signal(SIGINT,SIGNAL_CAST sig_int);
634 signal(SIGPIPE,SIGNAL_CAST sig_int);
635 signal(SIGHUP,SIGNAL_CAST sig_int);
636
c627d613
AT
637 if (dry_run)
638 verbose = MAX(verbose,1);
639
640 if (am_server) {
4fe159a8 641 remote_version = read_int(STDIN_FILENO);
7bec6a5c
AT
642 if (remote_version < MIN_PROTOCOL_VERSION ||
643 remote_version > MAX_PROTOCOL_VERSION) {
dc5ddbcc 644 fprintf(FERROR,"protocol version mismatch - is your shell clean?\n");
34ccb63e 645 exit_cleanup(1);
c627d613
AT
646 }
647 write_int(STDOUT_FILENO,PROTOCOL_VERSION);
648 write_flush(STDOUT_FILENO);
4fe159a8
AT
649
650 setup_protocol();
c627d613
AT
651
652 if (sender) {
653 recv_exclude_list(STDIN_FILENO);
654 if (cvs_exclude)
655 add_cvs_excludes();
656 do_server_sender(argc,argv);
657 } else {
658 do_server_recv(argc,argv);
659 }
34ccb63e 660 exit_cleanup(0);
c627d613
AT
661 }
662
663 if (argc < 2) {
dc5ddbcc 664 usage(FERROR);
34ccb63e 665 exit_cleanup(1);
c627d613
AT
666 }
667
668 p = strchr(argv[0],':');
669
670 if (p) {
671 sender = 0;
672 *p = 0;
673 shell_machine = argv[0];
674 shell_path = p+1;
675 argc--;
676 argv++;
677 } else {
678 sender = 1;
679
680 p = strchr(argv[argc-1],':');
681 if (!p) {
682 local_server = 1;
683 }
684
685 if (local_server) {
686 shell_machine = NULL;
687 shell_path = argv[argc-1];
688 } else {
689 *p = 0;
690 shell_machine = argv[argc-1];
691 shell_path = p+1;
692 }
693 argc--;
694 }
695
696 if (shell_machine) {
697 p = strchr(shell_machine,'@');
698 if (p) {
699 *p = 0;
700 shell_user = shell_machine;
701 shell_machine = p+1;
702 }
703 }
704
705 if (verbose > 3) {
dc5ddbcc 706 fprintf(FERROR,"cmd=%s machine=%s user=%s path=%s\n",
c627d613
AT
707 shell_cmd?shell_cmd:"",
708 shell_machine?shell_machine:"",
709 shell_user?shell_user:"",
710 shell_path?shell_path:"");
711 }
712
c627d613 713 if (!sender && argc != 1) {
dc5ddbcc 714 usage(FERROR);
34ccb63e 715 exit_cleanup(1);
c627d613
AT
716 }
717
718 pid = do_cmd(shell_cmd,shell_machine,shell_user,shell_path,&f_in,&f_out);
719
720 write_int(f_out,PROTOCOL_VERSION);
721 write_flush(f_out);
722 {
4fe159a8 723 remote_version = read_int(f_in);
7bec6a5c
AT
724 if (remote_version < MIN_PROTOCOL_VERSION ||
725 remote_version > MAX_PROTOCOL_VERSION) {
dc5ddbcc 726 fprintf(FERROR,"protocol version mismatch - is your shell clean?\n");
34ccb63e 727 exit_cleanup(1);
c627d613
AT
728 }
729 }
730
4fe159a8
AT
731 setup_protocol();
732
c627d613 733 if (verbose > 3)
dc5ddbcc 734 fprintf(FERROR,"parent=%d child=%d sender=%d recurse=%d\n",
c627d613
AT
735 (int)getpid(),pid,sender,recurse);
736
737 if (sender) {
738 if (cvs_exclude)
739 add_cvs_excludes();
740 if (delete_mode)
741 send_exclude_list(f_out);
742 flist = send_file_list(f_out,recurse,argc,argv);
743 if (verbose > 3)
dc5ddbcc 744 fprintf(FERROR,"file list sent\n");
c627d613
AT
745 send_files(flist,f_out,f_in);
746 if (verbose > 3)
dc5ddbcc 747 fprintf(FERROR,"waiting on %d\n",pid);
c627d613
AT
748 waitpid(pid, &status, 0);
749 report(-1);
34ccb63e 750 exit_cleanup(status);
c627d613
AT
751 }
752
753 send_exclude_list(f_out);
754
755 flist = recv_file_list(f_in);
756 if (!flist || flist->count == 0) {
dc5ddbcc 757 fprintf(FERROR,"nothing to do\n");
34ccb63e 758 exit_cleanup(0);
c627d613
AT
759 }
760
761 local_name = get_local_name(flist,argv[0]);
762
dc5ddbcc 763 status2 = do_recv(f_in,f_out,flist,local_name);
c627d613
AT
764
765 report(f_in);
766
767 waitpid(pid, &status, 0);
768
769 return status | status2;
770}