From 51ee0c2fb3e59a2d79d68aa27d1e15d16bcbceba Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Mon, 4 May 2009 21:52:22 +0000 Subject: Add report_flush(fp) function (report.c). svn path=/branches/BRANCH_6-3/; revision=5289 --- report.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'report.c') diff --git a/report.c b/report.c index ee8880a4..851f7dd1 100644 --- a/report.c +++ b/report.c @@ -1,4 +1,4 @@ -/* report.c -- report function for noninteractive utilities +/** \file report.c report function for noninteractive utilities * * For license terms, see the file COPYING in this directory. * @@ -43,6 +43,8 @@ static unsigned int partial_message_size = 0; static unsigned int partial_message_size_used = 0; static char *partial_message; +static int partial_suppress_tag = 0; + static unsigned unbuffered; static unsigned int use_syslog; @@ -123,13 +125,14 @@ report (FILE *errfp, message, va_alist) else /* i. e. not using syslog */ #endif { - fflush (errfp); if ( *message == '\n' ) { fputc( '\n', errfp ); ++message; } - fprintf (errfp, "%s: ", program_name); + if (!partial_suppress_tag) + fprintf (errfp, "%s: ", program_name); + partial_suppress_tag = 0; #ifdef VA_START VA_START (args, message); @@ -266,6 +269,16 @@ report_build (FILE *errfp, message, va_alist) } } +void report_flush(FILE *errfp) +{ + if (partial_message_size_used != 0) + { + partial_message_size_used = 0; + report(errfp, partial_message); + partial_suppress_tag = 1; + } +} + /* Complete a report message by appending MESSAGE, which is a printf-style format string with optional args, to the existing report message (which may be empty.) The completed report message is then printed (and reset to -- cgit v1.2.3