]> git.sur5r.net Git - cc65/blobdiff - src/ld65/error.c
Corrected indentation - no code change.
[cc65] / src / ld65 / error.c
index fa049488b0063b80fae1267c38926e10b9daf0d1..3fea97fdcf05520ad77a48aa383e6b825e2dcff6 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2000 Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 1998-2008 Ullrich von Bassewitz                                       */
+/*               Roemerstrasse 52                                            */
+/*               D-70794 Filderstadt                                         */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 #include <stdlib.h>
 #include <stdarg.h>
 
+/* common */
+#include "cmdline.h"
+#include "strbuf.h"
+
+/* ld65 */
 #include "error.h"
 
 
 void Warning (const char* Format, ...)
 /* Print a warning message */
 {
+    StrBuf S = STATIC_STRBUF_INITIALIZER;
     va_list ap;
+
     va_start (ap, Format);
-    fprintf (stderr, "Warning: ");
-    vfprintf (stderr, Format, ap);
-    putc ('\n', stderr);
+    SB_VPrintf (&S, Format, ap);
     va_end (ap);
+    SB_Terminate (&S);
+
+    fprintf (stderr, "%s: Warning: %s\n", ProgName, SB_GetConstBuf (&S));
+
+    SB_Done (&S);
 }
 
 
@@ -63,12 +73,18 @@ void Warning (const char* Format, ...)
 void Error (const char* Format, ...)
 /* Print an error message and die */
 {
+    StrBuf S = STATIC_STRBUF_INITIALIZER;
     va_list ap;
+
     va_start (ap, Format);
-    fprintf (stderr, "Error: ");
-    vfprintf (stderr, Format, ap);
-    putc ('\n', stderr);
+    SB_VPrintf (&S, Format, ap);
     va_end (ap);
+    SB_Terminate (&S);
+
+    fprintf (stderr, "%s: Error: %s\n", ProgName, SB_GetConstBuf (&S));
+
+    SB_Done (&S);
+
     exit (EXIT_FAILURE);
 }
 
@@ -77,12 +93,18 @@ void Error (const char* Format, ...)
 void Internal (const char* Format, ...)
 /* Print an internal error message and die */
 {
+    StrBuf S = STATIC_STRBUF_INITIALIZER;
     va_list ap;
+
     va_start (ap, Format);
-    fprintf (stderr, "Internal error: ");
-    vfprintf (stderr, Format, ap);
-    putc ('\n', stderr);
+    SB_VPrintf (&S, Format, ap);
     va_end (ap);
+    SB_Terminate (&S);
+
+    fprintf (stderr, "%s: Internal Error: %s\n", ProgName, SB_GetConstBuf (&S));
+
+    SB_Done (&S);
+
     exit (EXIT_FAILURE);
 }