Applied to the main code as option --outbuf=N|L|B.
authorWayne Davison <wayned@samba.org>
Sat, 28 Jan 2012 20:10:10 +0000 (12:10 -0800)
committerWayne Davison <wayned@samba.org>
Sat, 28 Jan 2012 20:10:10 +0000 (12:10 -0800)
stdout.diff [deleted file]

diff --git a/stdout.diff b/stdout.diff
deleted file mode 100644 (file)
index 041c0d1..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-This patch adds a --stdout=line|unbuf option that lets the
-user change the buffering of stdout.
-
-To use this patch, run these commands for a successful build:
-
-    patch -p1 <patches/stdout.diff
-    ./configure                            (optional if already run)
-    make
-
-based-on: 7c8f180900432e646c0a4bd02e2c4033068dbb7c
-diff --git a/options.c b/options.c
---- a/options.c
-+++ b/options.c
-@@ -303,6 +303,7 @@ static int refused_partial, refused_progress, refused_delete_before;
- static int refused_delete_during;
- static int refused_inplace, refused_no_iconv;
- static BOOL usermap_via_chown, groupmap_via_chown;
-+static char *stdout_buffering;
- static char *bwlimit_arg, *max_size_arg, *min_size_arg;
- static char tmp_partialdir[] = ".~tmp~";
-@@ -789,6 +790,7 @@ void usage(enum logcode F)
-   rprintf(F,"     --password-file=FILE    read daemon-access password from FILE\n");
-   rprintf(F,"     --list-only             list the files instead of copying them\n");
-   rprintf(F,"     --bwlimit=RATE          limit socket I/O bandwidth\n");
-+  rprintf(F,"     --stdout=line|unbuf     change buffering of stdout\n");
-   rprintf(F,"     --write-batch=FILE      write a batched update to FILE\n");
-   rprintf(F,"     --only-write-batch=FILE like --write-batch but w/o updating destination\n");
-   rprintf(F,"     --read-batch=FILE       read a batched update from FILE\n");
-@@ -1025,6 +1027,7 @@ static struct poptOption long_options[] = {
-   {"password-file",    0,  POPT_ARG_STRING, &password_file, 0, 0, 0 },
-   {"blocking-io",      0,  POPT_ARG_VAL,    &blocking_io, 1, 0, 0 },
-   {"no-blocking-io",   0,  POPT_ARG_VAL,    &blocking_io, 0, 0, 0 },
-+  {"stdout",           0,  POPT_ARG_STRING, &stdout_buffering, 0, 0, 0 },
-   {"remote-option",   'M', POPT_ARG_STRING, 0, 'M', 0, 0 },
-   {"protocol",         0,  POPT_ARG_INT,    &protocol_version, 0, 0, 0 },
-   {"checksum-seed",    0,  POPT_ARG_INT,    &checksum_seed, 0, 0, 0 },
-@@ -1810,6 +1813,13 @@ int parse_arguments(int *argc_p, const char ***argv_p)
-               }
-       }
-+      if (stdout_buffering && !am_server) {
-+              if (*stdout_buffering == 'u')
-+                      setvbuf(stdout, NULL, _IONBF, 0);
-+              else
-+                      setvbuf(stdout, NULL, _IOLBF, 0);
-+      }
-+
-       if (human_readable > 1 && argc == 2 && !am_server) {
-               /* Allow the old meaning of 'h' (--help) on its own. */
-               usage(FINFO);