summaryrefslogtreecommitdiff
path: root/src/user
diff options
context:
space:
mode:
Diffstat (limited to 'src/user')
-rw-r--r--src/user/lib/stdio/file.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/user/lib/stdio/file.c b/src/user/lib/stdio/file.c
index ab424d3..efaf013 100644
--- a/src/user/lib/stdio/file.c
+++ b/src/user/lib/stdio/file.c
@@ -242,13 +242,12 @@ int fputs(const char *s, FILE *f) {
return fprintf(f, "%s\n", s);
}
-// TODO! c file buffering
char *fgets(char *buf, int size, FILE *f) {
int pos, c;
- for (pos = 0; pos < size-1; pos++) {
+ for (pos = 0; pos < size-1; ) {
c = fgetc(f);
if (c == EOF) break;
- buf[pos] = c;
+ buf[pos++] = c;
if (c == '\n') break;
}
if (pos == 0 || f->error) {