diff src/error.cc @ 581:bc813f5eb025

[project @ 1994-08-07 01:02:15 by jwe]
author jwe
date Sun, 07 Aug 1994 01:02:15 +0000
parents e1e6e33e26f8
children 3ed5cf2aef94
line wrap: on
line diff
--- a/src/error.cc
+++ b/src/error.cc
@@ -25,8 +25,7 @@
 #include "config.h"
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
+#include <strstream.h>
 #include <stdarg.h>
 
 #include "utils.h"
@@ -42,12 +41,21 @@
 static void
 verror (const char *name, const char *fmt, va_list args)
 {
-  if (name)
-    fprintf (stderr, "%s: ", name);
+  cerr << name << ": ";
+  cerr.vform (fmt, args);
+  cerr << endl;
+
+  ostrstream output_buf;
 
-  vfprintf (stderr, fmt, args);
-  fprintf (stderr, "\n");
-  fflush (stderr);
+  output_buf << name << ": ";
+  output_buf.vform (fmt, args);
+  output_buf << endl;
+
+  char *msg = output_buf.str ();
+
+  maybe_write_to_diary_file (msg);
+
+  delete [] msg;
 }
 
 void