]> git.sur5r.net Git - cc65/blobdiff - src/ld65/error.c
Corrected indentation - no code change.
[cc65] / src / ld65 / error.c
index 53b06d16bdffcbe60bf815093f3a92c576b08684..3fea97fdcf05520ad77a48aa383e6b825e2dcff6 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998     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>
 
-#include "error.h"
-
-
-
-/*****************************************************************************/
-/*                                  Data                                    */
-/*****************************************************************************/
-
-
+/* common */
+#include "cmdline.h"
+#include "strbuf.h"
 
-/* Messages for internal compiler errors */
-const char _MsgCheckFailed [] =
-    "Check failed: `%s' (= %d), file `%s', line %u\n";
-const char _MsgPrecondition [] =
-    "Precondition violated: `%s' (= %d), file `%s', line %u\n";
-const char _MsgFail [] =
-    "%s, file `%s', line %u\n";
+/* ld65 */
+#include "error.h"
 
 
 
@@ -66,12 +55,17 @@ const char _MsgFail [] =
 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);
 }
 
 
@@ -79,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);
 }
 
@@ -93,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);
 }