From d397eac2d944886ff1fb129783ef3c8d1b4aa0ae Mon Sep 17 00:00:00 2001 From: Max Wash Date: Mon, 21 Dec 2020 23:24:04 +0000 Subject: [PATCH] fputs() no longer prints an extra \n --- photon/libc/stdio/fputs.c | 5 ----- photon/libc/stdio/puts.c | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/photon/libc/stdio/fputs.c b/photon/libc/stdio/fputs.c index 0737d0a..3c31f3f 100644 --- a/photon/libc/stdio/fputs.c +++ b/photon/libc/stdio/fputs.c @@ -10,10 +10,5 @@ int fputs(const char *str, FILE *fp) } } - __fio_write(fp, "\n", 1); - if (__fio_error(fp)) { - return EOF; - } - return 0; } diff --git a/photon/libc/stdio/puts.c b/photon/libc/stdio/puts.c index 9f17894..d0d216b 100644 --- a/photon/libc/stdio/puts.c +++ b/photon/libc/stdio/puts.c @@ -2,5 +2,10 @@ int puts(const char *str) { - return fputs(str, stdout); + int r = fputs(str, stdout); + if (r != 0) { + return r; + } + + return fputc('\n', stdout); }