From 4290e4d6aa07c428cb89a722f34764620a47d64a Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 15 Oct 2025 14:51:18 -0400 Subject: libc: stdio: Add puts() function Signed-off-by: Ian Moffett --- src/lib/libc/include/stdio.h | 7 +++++++ src/lib/libc/src/stdio/puts.c | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'src/lib') diff --git a/src/lib/libc/include/stdio.h b/src/lib/libc/include/stdio.h index c8b7c10..31d59a5 100644 --- a/src/lib/libc/include/stdio.h +++ b/src/lib/libc/include/stdio.h @@ -52,6 +52,13 @@ int puts(const char *s); int vsnprintf(char *s, size_t size, const char *fmt, va_list ap); int snprintf(char *s, size_t size, const char *fmt, ...); +/* + * Write a character to stdout + * + * @c: Character to write + */ +int putchar(int c); + /* * Print a formatted string */ diff --git a/src/lib/libc/src/stdio/puts.c b/src/lib/libc/src/stdio/puts.c index 6446e10..021bf89 100644 --- a/src/lib/libc/src/stdio/puts.c +++ b/src/lib/libc/src/stdio/puts.c @@ -46,3 +46,10 @@ puts(const char *s) write(STDOUT_FILENO, &ch_lf, 1); return slen + 1; } + +int +putchar(int c) +{ + write(STDOUT_FILENO, &c, 1); + return c; +} -- cgit v1.2.3