libc: Implement perror()
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e676fb8299
commit
28bde216c4
@ -58,6 +58,9 @@ extern "C"
|
|||||||
/* Output a message to the console. */
|
/* Output a message to the console. */
|
||||||
int console_write(const char* msg, size_t size);
|
int console_write(const char* msg, size_t size);
|
||||||
|
|
||||||
|
/* Write an error message to standard error. */
|
||||||
|
void perror(const char* s);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -70,6 +70,14 @@ extern "C"
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void perror(const char* s)
|
||||||
|
{
|
||||||
|
// FIXME: Output to stderr when available.
|
||||||
|
int err = errno;
|
||||||
|
if (s && *s) printf("%s: ", s);
|
||||||
|
printf("%s\n", strerror(err));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug_log_impl(const char* format, va_list ap)
|
void debug_log_impl(const char* format, va_list ap)
|
||||||
|
Loading…
Reference in New Issue
Block a user