mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
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:
13
src/extern/err.c
vendored
13
src/extern/err.c
vendored
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user