From 8d5b9f3ea1c6a8bb50d8c0e166c9508fedc26631 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Mon, 29 Oct 2007 22:46:45 +0000 Subject: [PATCH] Submitted by : patch #5007: Patch for line-buffering of stdout and stderr git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@757 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 6 ++++++ main.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3bd265da..96a4b5c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-10-29 Joerg Wunsch + + Submitted by : + patch #5007: Patch for line-buffering of stdout and stderr + * main.c: call setvbuf() for stdout and stderr. + 2007-10-29 Joerg Wunsch Submitted by : diff --git a/main.c b/main.c index 860fafac..6af9f31d 100644 --- a/main.c +++ b/main.c @@ -272,6 +272,13 @@ int main(int argc, char * argv []) char * homedir; #endif + /* + * Set line buffering for file descriptors so we see stdout and stderr + * properly interleaved. + */ + setvbuf(stdout, (char*)NULL, _IOLBF, 0); + setvbuf(stderr, (char*)NULL, _IOLBF, 0); + progname = strrchr(argv[0],'/'); #if defined (WIN32NATIVE)