X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/c226b7c2fdd6cc4357337514b22c3042195ab091..52d7d78865a5478cffdc0e51ff0f1e7a6aee373e:/main.c diff --git a/main.c b/main.c index 87405579..56a078bf 100644 --- a/main.c +++ b/main.c @@ -40,20 +40,30 @@ static void report(int f) if (f == -1 || !am_sender) return; } - if (!verbose) return; - - if (am_server && !am_sender) return; - - if (am_server && am_sender) { - write_longint(f,stats.total_read); - write_longint(f,stats.total_written); - write_longint(f,stats.total_size); + if (am_server) { + if (verbose && am_sender) { + int64 w; + /* store total_written in a temporary + because write_longint changes it */ + w = stats.total_written; + write_longint(f,stats.total_read); + write_longint(f,w); + write_longint(f,stats.total_size); + } return; } - - if (!am_sender) { + + /* this is the client */ + + if (!am_sender && verbose) { + /* note that if (!verbose && do_stats) then these values will + be taken from the receiver side's copy. The total size + is identical but the bytes read and written are slightly + different. It's done this way to avoid modifying the + protocol to support --stats without -v. */ int64 r; stats.total_written = read_longint(f); + /* store total_read in a temporary, read_longint changes it */ r = read_longint(f); stats.total_size = read_longint(f); stats.total_read = r; @@ -78,13 +88,15 @@ static void report(int f) (double)stats.total_read); } - rprintf(FINFO,"wrote %.0f bytes read %.0f bytes %.2f bytes/sec\n", - (double)stats.total_written, - (double)stats.total_read, - (stats.total_written+stats.total_read)/(0.5 + (t-starttime))); - rprintf(FINFO,"total size is %.0f speedup is %.2f\n", - (double)stats.total_size, - (1.0*stats.total_size)/(stats.total_written+stats.total_read)); + if (verbose || do_stats) { + rprintf(FINFO,"wrote %.0f bytes read %.0f bytes %.2f bytes/sec\n", + (double)stats.total_written, + (double)stats.total_read, + (stats.total_written+stats.total_read)/(0.5 + (t-starttime))); + rprintf(FINFO,"total size is %.0f speedup is %.2f\n", + (double)stats.total_size, + (1.0*stats.total_size)/(stats.total_written+stats.total_read)); + } fflush(stdout); fflush(stderr); @@ -592,7 +604,7 @@ int main(int argc,char *argv[]) carried across */ orig_umask = (int)umask(0); - if (!parse_arguments(argc, argv)) { + if (!parse_arguments(argc, argv, 1)) { exit_cleanup(RERR_SYNTAX); }