diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-15 14:51:18 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-15 14:51:18 -0400 |
commit | 4290e4d6aa07c428cb89a722f34764620a47d64a (patch) | |
tree | 3d5bbcf0a9b83b7e4ec943b1fd8189be4bba2c2b /src | |
parent | bf1a7ec34836c44ff7c0b670ec95f3e40455d51a (diff) |
libc: stdio: Add puts() function
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/include/stdio.h | 7 | ||||
-rw-r--r-- | src/lib/libc/src/stdio/puts.c | 7 |
2 files changed, 14 insertions, 0 deletions
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 @@ -53,6 +53,13 @@ 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 */ int printf(const char *__restrict fmt, ...); 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; +} |