aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-05-18 20:31:37 -0400
committerIan Moffett <ian@osmora.org>2024-05-18 20:31:37 -0400
commit9820e8d18a2b459e95faf004573ada9fa8f16627 (patch)
tree4e30e3fd6ea851b1f5089741ff8f5747e06a42fa /sys
parent68bc6fb38fe2f308746d74de1973c7aa84fed440 (diff)
kernel: tty: Add tty_putstr()
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r--sys/include/sys/tty.h1
-rw-r--r--sys/kern/kern_tty.c17
2 files changed, 18 insertions, 0 deletions
diff --git a/sys/include/sys/tty.h b/sys/include/sys/tty.h
index 4a2c9ec..c53ea73 100644
--- a/sys/include/sys/tty.h
+++ b/sys/include/sys/tty.h
@@ -57,6 +57,7 @@ extern struct tty g_root_tty;
dev_t tty_attach(struct tty *tty);
int tty_putc(struct tty *tty, int c);
+int tty_putstr(struct tty *tty, const char *s, size_t count);
ssize_t tty_flush(struct tty *tty);
#endif /* !_SYS_TTY_H_ */
diff --git a/sys/kern/kern_tty.c b/sys/kern/kern_tty.c
index 7be7042..8446e2b 100644
--- a/sys/kern/kern_tty.c
+++ b/sys/kern/kern_tty.c
@@ -181,6 +181,23 @@ tty_putc(struct tty *tty, int c)
return 0;
}
+/*
+ * Write a string to a TTY
+ *
+ * @tty: TTY to write to.
+ * @s: String to write.
+ * @count: Number of bytes to write.
+ */
+int
+tty_putstr(struct tty *tty, const char *s, size_t count)
+{
+ for (size_t i = 0; i < count; ++i) {
+ tty_putc(tty, *s++);
+ }
+
+ return 0;
+}
+
dev_t
tty_attach(struct tty *tty)
{