From e70d6db9a9513c6e2040f118264b1dd606ca5fe6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 18 Feb 1997 03:57:19 +0000 Subject: Dave Bodenstab's error-message corrections. svn path=/trunk/; revision=900 --- report.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'report.c') diff --git a/report.c b/report.c index f6fbd765..174abeb9 100644 --- a/report.c +++ b/report.c @@ -315,8 +315,7 @@ error_build (message, va_alist) partial_message = xrealloc (partial_message, partial_message_size); } #else - VA_START (args, message); - vsprintf (partial_message + partial_message_size_used, message, args); + sprintf (partial_message + partial_message_size_used, message, a1, a2, a3, a4, a5, a6, a7, a8); /* Attempt to catch memory overwrites... */ if ((partial_message_size_used = strlen (partial_message)) >= partial_message_size) @@ -324,7 +323,6 @@ error_build (message, va_alist) partial_message_size_used = 0; error (PS_UNDEFINED, 0, "partial error message buffer overflow"); } - va_end (args); #endif #endif @@ -407,8 +405,7 @@ error_complete (status, errnum, message, va_alist) partial_message = xrealloc (partial_message, partial_message_size); } #else - VA_START (args, message); - vsprintf (partial_message + partial_message_size_used, message, args); + sprintf (partial_message + partial_message_size_used, message, a1, a2, a3, a4, a5, a6, a7, a8); /* Attempt to catch memory overwrites... */ if ((partial_message_size_used = strlen (partial_message)) >= partial_message_size) @@ -416,28 +413,29 @@ error_complete (status, errnum, message, va_alist) partial_message_size_used = 0; error (PS_UNDEFINED, 0, "partial error message buffer overflow"); } - va_end (args); #endif #endif /* Finally... print it. */ - if (partial_message_size_used != 0) + partial_message_size_used = 0; + + if (use_stderr) { - partial_message_size_used = 0; - if (use_stderr) - { - fputs(partial_message, stderr); - if (errnum) - fprintf (stderr, ": %s", strerror (errnum)); - putc ('\n', stderr); - fflush (stderr); - ++error_message_count; - if (status) - exit(status); - } - else - error (status, errnum, "%s", partial_message); + fputs(partial_message, stderr); + + if (errnum) + fprintf (stderr, ": %s", strerror (errnum)); + + putc ('\n', stderr); + fflush (stderr); + + ++error_message_count; + + if (status) + exit(status); } + else + error (status, errnum, "%s", partial_message); } /* Sometimes we want to have at most one error per line. This -- cgit v1.2.3