/* */
/* */
/* */
-/* (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);
}
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);
}
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);
}