aboutsummaryrefslogtreecommitdiffstats
path: root/report.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2009-05-04 21:52:22 +0000
committerMatthias Andree <matthias.andree@gmx.de>2009-05-04 21:52:22 +0000
commit51ee0c2fb3e59a2d79d68aa27d1e15d16bcbceba (patch)
tree7f9929a5a9d15655af740241c5ce3c84e5e0639e /report.c
parentce32a9de022a005deb6d32dc1f567d4ec919d7c3 (diff)
downloadfetchmail-51ee0c2fb3e59a2d79d68aa27d1e15d16bcbceba.tar.gz
fetchmail-51ee0c2fb3e59a2d79d68aa27d1e15d16bcbceba.tar.bz2
fetchmail-51ee0c2fb3e59a2d79d68aa27d1e15d16bcbceba.zip
Add report_flush(fp) function (report.c).
svn path=/branches/BRANCH_6-3/; revision=5289
Diffstat (limited to 'report.c')
-rw-r--r--report.c19
1 files changed, 16 insertions, 3 deletions
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