diff options
Diffstat (limited to 'lib/stdlib/puts.c')
-rw-r--r-- | lib/stdlib/puts.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/stdlib/puts.c b/lib/stdlib/puts.c index 069a64fc..7549eb88 100644 --- a/lib/stdlib/puts.c +++ b/lib/stdlib/puts.c @@ -29,19 +29,27 @@ */ #include <stdio.h> -#include <console.h> int puts(const char *s) { int count = 0; while(*s) { - if (console_putc(*s++)) { + if (putchar(*s++) != EOF) { count++; } else { - count = EOF; // -1 in stdio.h + count = EOF; break; } } + + /* According to the puts(3) manpage, the function should write a + * trailing newline. + */ + if ((count != EOF) && (putchar('\n') != EOF)) + count++; + else + count = EOF; + return count; } |