Have RGBDS' err and warn output an error message

The stdlib functions specify the difference between `err` and `errx`
is that the former prints a message obtained with `strerror`.
However, RGBDS' implementation breaks that contract, and `warn`'s puts the
added semicolon in the wrong place.
This commit is contained in:
ISSOtm
2019-09-12 22:08:04 +02:00
parent 323738e7b8
commit 696feae32e

13
src/extern/err.c vendored
View File

@@ -14,13 +14,12 @@
void rgbds_vwarn(const char *fmt, va_list ap)
{
fprintf(stderr, "warning");
fprintf(stderr, "warning: ");
if (fmt) {
fputs(": ", stderr);
vfprintf(stderr, fmt, ap);
fputs(": ", stderr);
}
putc('\n', stderr);
perror(0);
perror(NULL);
}
void rgbds_vwarnx(const char *fmt, va_list ap)
@@ -35,12 +34,12 @@ void rgbds_vwarnx(const char *fmt, va_list ap)
noreturn_ void rgbds_verr(int status, const char *fmt, va_list ap)
{
fprintf(stderr, "error");
fprintf(stderr, "error: ");
if (fmt) {
fputs(": ", stderr);
vfprintf(stderr, fmt, ap);
fputs(": ", stderr);
}
putc('\n', stderr);
perror(NULL);
exit(status);
}