From d1bafb75630db5cc07825e53f28a241c2005b43b Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 19 Mar 2024 21:31:38 -0400 Subject: kernel: vcons: Add vcons_putstr() routine Signed-off-by: Ian Moffett --- sys/dev/vcons/vcons.c | 19 +++++++++++++++++++ sys/include/dev/vcons/vcons.h | 1 + 2 files changed, 20 insertions(+) (limited to 'sys') diff --git a/sys/dev/vcons/vcons.c b/sys/dev/vcons/vcons.c index 91ea906..cba0b85 100644 --- a/sys/dev/vcons/vcons.c +++ b/sys/dev/vcons/vcons.c @@ -197,6 +197,25 @@ vcons_putch(struct vcons_screen *scr, char c) return 0; } +/* + * Write out a string on the console. + * + * @s: String to write. + */ +int +vcons_putstr(struct vcons_screen *scr, const char *s) +{ + int status; + + while (*s != '\0') { + if ((status = vcons_putch(scr, *(s++))) != 0) { + return status; + } + } + + return 0; +} + void vcons_attach(struct vcons_screen *scr) { diff --git a/sys/include/dev/vcons/vcons.h b/sys/include/dev/vcons/vcons.h index 737651f..9deb656 100644 --- a/sys/include/dev/vcons/vcons.h +++ b/sys/include/dev/vcons/vcons.h @@ -67,6 +67,7 @@ struct vcons_screen { void vcons_attach(struct vcons_screen *scr); int vcons_putch(struct vcons_screen *scr, char c); +int vcons_putstr(struct vcons_screen *scr, const char *s); void vcons_update_cursor(struct vcons_screen *scr); #endif /* !_DEV_VCONS_H_ */ -- cgit v1.2.3