fix(userspace/libc): wrong puts() implementation

The implementation didn't fully followed the POSIX.1-2024 standard "The puts() function shall write the string pointed to by s, followed by a <newline>, to the standard output stream stdout. The terminating null byte shall not be written."

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2025-03-03 12:08:39 +00:00
parent 451c5405e0
commit 659805960b
No known key found for this signature in database
GPG Key ID: 2EE20AF089811A5A

View File

@ -455,7 +455,15 @@ export int putc(int c, FILE *stream) { return fputc(c, stream); }
export int putchar(int c) { return putc(c, stdout); }
export int putc_unlocked(int c, FILE *stream) { return fputc(c, stream); }
export int putchar_unlocked(int c) { return putc_unlocked(c, stdout); }
export int puts(const char *s) { return fputs(s, stdout); }
export int puts(const char *s)
{
if (fputs(s, stdout) == EOF)
return EOF;
if (fputc('\n', stdout) == EOF)
return EOF;
return 0;
}
export int remove(const char *);
export int rename(const char *, const char *);