diff --git a/options.c b/options.c index 4128b59..77c7132 100644 --- a/options.c +++ b/options.c @@ -293,6 +293,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = { static int verbose = 0; static int do_stats = 0; static int do_progress = 0; +int do_line_buffered = 0; static int daemon_opt; /* sets am_daemon after option error-reporting */ static int omit_dir_times = 0; static int omit_link_times = 0; @@ -786,6 +787,7 @@ void usage(enum logcode F) rprintf(F," -h, --human-readable output numbers in a human-readable format\n"); rprintf(F," --progress show progress during transfer\n"); rprintf(F," -P same as --partial --progress\n"); + rprintf(F," --line-buffered output single line progress messages suitable for pipes\n"); rprintf(F," -i, --itemize-changes output a change-summary for all updates\n"); rprintf(F," --out-format=FORMAT output updates using the specified FORMAT\n"); rprintf(F," --log-file=FILE log what we're doing to the specified FILE\n"); @@ -976,6 +978,8 @@ static struct poptOption long_options[] = { {0, 'P', POPT_ARG_NONE, 0, 'P', 0, 0 }, {"progress", 0, POPT_ARG_VAL, &do_progress, 1, 0, 0 }, {"no-progress", 0, POPT_ARG_VAL, &do_progress, 0, 0, 0 }, + {"line-buffered", 0, POPT_ARG_VAL, &do_line_buffered, 1, 0, 0 }, + {"no-line-buffered", 0, POPT_ARG_VAL, &do_line_buffered, 0, 0, 0 }, {"partial", 0, POPT_ARG_VAL, &keep_partial, 1, 0, 0 }, {"no-partial", 0, POPT_ARG_VAL, &keep_partial, 0, 0, 0 }, {"partial-dir", 0, POPT_ARG_STRING, &partial_dir, 0, 0, 0 }, diff --git a/progress.c b/progress.c index 318a77f..0587d3c 100644 --- a/progress.c +++ b/progress.c @@ -24,6 +24,7 @@ #include "inums.h" extern int am_server; +extern int do_line_buffered; extern int flist_eof; extern int need_unsorted_flist; extern int output_needs_newline; @@ -217,5 +218,5 @@ void show_progress(OFF_T ofs, OFF_T size) return; #endif - rprint_progress(ofs, size, &now, False); + rprint_progress(ofs, size, &now, False || do_line_buffered); }