diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2009-05-04 21:52:22 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2009-05-04 21:52:22 +0000 |
commit | 51ee0c2fb3e59a2d79d68aa27d1e15d16bcbceba (patch) | |
tree | 7f9929a5a9d15655af740241c5ce3c84e5e0639e | |
parent | ce32a9de022a005deb6d32dc1f567d4ec919d7c3 (diff) | |
download | fetchmail-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
-rw-r--r-- | fetchmail.h | 2 | ||||
-rw-r--r-- | report.c | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/fetchmail.h b/fetchmail.h index 35dfa223..4b32a889 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -472,6 +472,8 @@ const char *norm_charmap(const char *name); /* error.c: Error reporting */ #if defined(HAVE_STDARG_H) void report_init(int foreground); + /** Flush partial message, suppress program name tag for next report printout. */ +void report_flush(FILE *fp); void report (FILE *fp, const char *format, ...) __attribute__ ((format (printf, 2, 3))) ; @@ -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 |