diff options
author | Quinn Stephens <quinn@osmora.org> | 2025-06-06 13:49:53 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-06-07 18:18:23 -0400 |
commit | 75193df68e776a469bc4a40445db6f4d7943a21e (patch) | |
tree | b1dfb53d4d6d987e95209d043d8e5f7045dddcac /usr.bin/kmsg/kmsg.c | |
parent | f7ed50328af7b6a5151f86126a3491a768a7d1ff (diff) |
usr.bin: Use stdio for console access
Modified fetch, kmsg, and osh to use stdio.h routines instead of just
raw file descriptors.
Signed-off-by: Quinn Stephens <quinn@osmora.org>
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin/kmsg/kmsg.c')
-rw-r--r-- | usr.bin/kmsg/kmsg.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.bin/kmsg/kmsg.c b/usr.bin/kmsg/kmsg.c index 678ad8c..2deae39 100644 --- a/usr.bin/kmsg/kmsg.c +++ b/usr.bin/kmsg/kmsg.c @@ -31,21 +31,18 @@ #include <unistd.h> #include <fcntl.h> #include <string.h> +#include <stdio.h> int main(void) { - int mfd, cons_fd; + int mfd; ssize_t retval; char linebuf[256]; if ((mfd = open("/dev/kmsg", O_RDONLY)) < 0) { return mfd; } - if ((cons_fd = open("/dev/console", O_WRONLY)) < 0) { - close(mfd); - return cons_fd; - } for (;;) { retval = read(mfd, linebuf, sizeof(linebuf) - 1); @@ -53,10 +50,9 @@ main(void) break; } linebuf[retval] = '\0'; - write(cons_fd, linebuf, strlen(linebuf)); + fputs(linebuf, stdout); } - close(cons_fd); close(mfd); return 0; } |