aboutsummaryrefslogtreecommitdiffstats
path: root/report.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1999-02-03 02:55:59 +0000
committerEric S. Raymond <esr@thyrsus.com>1999-02-03 02:55:59 +0000
commitd0c2c187633fa906eee672c21f46a2ac68148d15 (patch)
treefc51a3d3a52c16d7edc82f1a388f4107ea238d95 /report.c
parentb7406a23e1b4e9279e7bffd88352a20574a45f62 (diff)
downloadfetchmail-d0c2c187633fa906eee672c21f46a2ac68148d15.tar.gz
fetchmail-d0c2c187633fa906eee672c21f46a2ac68148d15.tar.bz2
fetchmail-d0c2c187633fa906eee672c21f46a2ac68148d15.zip
Simplify error reporting further.
svn path=/trunk/; revision=2374
Diffstat (limited to 'report.c')
-rw-r--r--report.c63
1 files changed, 9 insertions, 54 deletions
diff --git a/report.c b/report.c
index 2d53bb1a..5a33d71b 100644
--- a/report.c
+++ b/report.c
@@ -110,10 +110,9 @@ char *strerror (errnum)
void
#ifdef HAVE_STDARG_H
-report (FILE *errfp, int errnum, const char *message, ...)
+report (FILE *errfp, const char *message, ...)
#else
-report (FILE *errfp, errnum, message, va_alist)
- int errnum;
+report (FILE *errfp, message, va_alist)
const char *message;
va_dcl
#endif
@@ -137,40 +136,12 @@ report (FILE *errfp, errnum, message, va_alist)
#ifdef VA_START
VA_START (args, message);
#endif
- priority = errnum ? LOG_ERR : LOG_INFO;
-
- if (errnum > 0)
- {
- char *msg;
-
- xalloca(msg, char *, strlen (message) + 5);
-
- strcpy (msg, message);
- strcat (msg, ": %m");
+ priority = (errfp == stderr) ? LOG_ERR : LOG_INFO;
- errno = errnum;
-#ifdef HAVE_VSYSLOG
- vsyslog (priority, msg, args);
-#else
- {
- char *a1 = va_arg(args, char *);
- char *a2 = va_arg(args, char *);
- char *a3 = va_arg(args, char *);
- char *a4 = va_arg(args, char *);
- char *a5 = va_arg(args, char *);
- char *a6 = va_arg(args, char *);
- char *a7 = va_arg(args, char *);
- char *a8 = va_arg(args, char *);
- syslog (priority, msg, a1, a2, a3, a4, a5, a6, a7, a8);
- }
-#endif
- }
- else
- {
#ifdef HAVE_VSYSLOG
- vsyslog (priority, message, args);
+ vsyslog (priority, message, args);
#else
- {
+ {
char *a1 = va_arg(args, char *);
char *a2 = va_arg(args, char *);
char *a3 = va_arg(args, char *);
@@ -180,9 +151,8 @@ report (FILE *errfp, errnum, message, va_alist)
char *a7 = va_arg(args, char *);
char *a8 = va_arg(args, char *);
syslog (priority, message, a1, a2, a3, a4, a5, a6, a7, a8);
- }
+ }
#endif
- }
#ifdef VA_START
va_end(args);
@@ -215,16 +185,6 @@ report (FILE *errfp, errnum, message, va_alist)
#else
fprintf (errfp, message, a1, a2, a3, a4, a5, a6, a7, a8);
#endif
-
- if (errnum) {
- char *tmps = strerror(errnum);
- if (tmps) {
- fprintf (errfp, ": %s", tmps);
- }
- else {
- fprintf (errfp, _(": Error %d"), errnum);
- }
- }
fflush (errfp);
}
++error_message_count;
@@ -371,10 +331,9 @@ report_build (FILE *errfp, message, va_alist)
void
#ifdef HAVE_STDARG_H
-report_complete (FILE *errfp, int errnum, const char *message, ...)
+report_complete (FILE *errfp, const char *message, ...)
#else
-report_complete (FILE *errfp, errnum, message, va_alist)
- int errnum;
+report_complete (FILE *errfp, message, va_alist)
const char *message;
va_dcl
#endif
@@ -463,16 +422,12 @@ report_complete (FILE *errfp, errnum, message, va_alist)
if (use_stderr)
{
fputs(partial_message, errfp);
-
- if (errnum)
- fprintf (errfp, ": %s", strerror (errnum));
-
fflush (errfp);
++error_message_count;
}
else
- report (errfp, errnum, "%s", partial_message);
+ report(errfp, "%s", partial_message);
}
/* Sometimes we want to have at most one error per line. This