Provide implementation for perror(3)

This commit is contained in:
Xavier Del Campo Romero 2021-10-24 02:49:21 +02:00
parent 80beba98c7
commit eaff9ccf1d
2 changed files with 6 additions and 0 deletions

View File

@ -123,6 +123,7 @@ void clearerr(FILE *stream);
int feof(FILE *stream);
int ferror(FILE *stream);
int fileno(FILE *stream);
void perror(const char *s);
#define getc(f) fgetc(f)

View File

@ -114,3 +114,8 @@ int strerror_r(int errnum, char *strerrbuf, size_t buflen)
snprintf(strerrbuf, buflen, "Unknown error %d", errnum);
return -1;
}
void perror(const char *s)
{
fprintf(stderr, "%s: %s\n", s, strerror(errno));
}