X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fld65%2Ferror.c;h=3fea97fdcf05520ad77a48aa383e6b825e2dcff6;hb=0807da74bd7c3ebe3e6e75129a07a810b17174b2;hp=fa049488b0063b80fae1267c38926e10b9daf0d1;hpb=5ee8618510eacaca1f779612103bf709f59e9450;p=cc65 diff --git a/src/ld65/error.c b/src/ld65/error.c index fa049488b..3fea97fdc 100644 --- a/src/ld65/error.c +++ b/src/ld65/error.c @@ -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 */ @@ -37,6 +37,11 @@ #include #include +/* common */ +#include "cmdline.h" +#include "strbuf.h" + +/* ld65 */ #include "error.h" @@ -50,12 +55,17 @@ 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); }