Index: CommandLine.c =================================================================== RCS file: /cactusdevcvs/Cactus/src/main/CommandLine.c,v retrieving revision 1.64 diff -u -r1.64 CommandLine.c --- CommandLine.c 29 Jun 2006 16:25:58 -0000 1.64 +++ CommandLine.c 4 Feb 2007 21:17:29 -0000 @@ -51,6 +51,8 @@ static char* logdir = NULL; static int requested_stdout_redirection = 0; static int requested_stderr_redirection = 0; +static int did_request_buffering_mode = 0; +static int requested_buffering_mode = 0; static int paramchecking = 0; @@ -497,17 +501,20 @@ if (! strcmp (argument, "no")) { /* Switch to unbuffered mode (best for debugging) */ - setvbuf (stdout, NULL, _IONBF, 0); + did_request_buffering_mode = 1; + requested_buffering_mode = _IONBF; } else if (! strcmp (argument, "line")) { /* Switch to line buffered mode (good for screen output) */ - setvbuf (stdout, NULL, _IOLBF, 0); + did_request_buffering_mode = 1; + requested_buffering_mode = _IOLBF; } else if (! strcmp (argument, "full")) { /* Switch to fully buffered mode (fastest) */ - setvbuf (stdout, NULL, _IOFBF, 0); + did_request_buffering_mode = 1; + requested_buffering_mode = _IOFBF; } else { @@ -741,6 +817,12 @@ free (logfilename); } free (logdir); + + /* set output buffering mode */ + if (did_request_buffering_mode) + { + setvbuf (stdout, NULL, requested_buffering_mode, 0); + } }