libc: Add more spacing to stdio.cpp

This commit is contained in:
apio 2022-10-22 12:21:04 +02:00
parent 6dc51abfc8
commit 063e2d5e7a

View File

@ -15,12 +15,14 @@ extern "C"
if (putchar('\n') < 0) return -1; if (putchar('\n') < 0) return -1;
return nwritten + 1; return nwritten + 1;
} }
int fputs(const char* s, FILE* stream) int fputs(const char* s, FILE* stream)
{ {
int result = (int)fwrite(s, strlen(s), 1, stream); int result = (int)fwrite(s, strlen(s), 1, stream);
if (ferror(stream)) return -1; if (ferror(stream)) return -1;
return result; return result;
} }
int fputc(int c, FILE* stream) int fputc(int c, FILE* stream)
{ {
char chr = (char)c; char chr = (char)c;
@ -28,14 +30,17 @@ extern "C"
if (ferror(stream)) { return -1; } if (ferror(stream)) { return -1; }
return c; return c;
} }
int putc(int c, FILE* stream) int putc(int c, FILE* stream)
{ {
return fputc(c, stream); return fputc(c, stream);
} }
int putchar(int c) int putchar(int c)
{ {
return fputc(c, stdout); return fputc(c, stdout);
} }
void perror(const char* s) void perror(const char* s)
{ {
int savederr = int savederr =
@ -43,6 +48,7 @@ extern "C"
if (s && *s) { fprintf(stderr, "%s: ", s); } if (s && *s) { fprintf(stderr, "%s: ", s); }
fprintf(stderr, "%s\n", strerror(savederr)); fprintf(stderr, "%s\n", strerror(savederr));
} }
int remove(const char*) int remove(const char*)
{ {
NOT_IMPLEMENTED("remove"); NOT_IMPLEMENTED("remove");