#include "Rts.h"
#include <stdio.h>
+#include <string.h>
+#include <errno.h>
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#define xstr(s) str(s)
#define str(s) #s
-void
+void GNU_ATTRIBUTE(__noreturn__)
rtsFatalInternalErrorFn(const char *s, va_list ap)
{
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
#endif
{
/* don't fflush(stdout); WORKAROUND bug in Linux glibc */
- if (prog_argv != NULL && prog_name != NULL) {
+ if (prog_name != NULL) {
fprintf(stderr, "%s: ", prog_name);
}
vfprintf(stderr, s, ap);
}
vfprintf(stderr, s, ap);
if (syserr) {
+#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
+ // Win32 error messages have a terminating \n
+ fprintf(stderr, ": %s", syserr);
+#else
fprintf(stderr, ": %s\n", syserr);
+#endif
} else {
fprintf(stderr, "\n");
}