diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-25 03:30:40 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-25 03:30:40 -0400 |
commit | 71cb1ceaaa894f642e2d294684d6ac83e965137a (patch) | |
tree | 522419ac429635d408d0c0a3740060ee61b22cce /usr.bin/osh | |
parent | eba141e6dcef379f3be50e3e2a5a1e4bfad9131a (diff) |
usr: osh: Print banner from /etc/motd
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin/osh')
-rw-r--r-- | usr.bin/osh/osh.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/osh/osh.c b/usr.bin/osh/osh.c index af7f4ab..3b41747 100644 --- a/usr.bin/osh/osh.c +++ b/usr.bin/osh/osh.c @@ -426,6 +426,25 @@ open_script(const char *pathname) return 0; } +static void +dump_file(const char *pathname) +{ + FILE *file; + char buf[64]; + int fd; + + file = fopen(pathname, "r"); + if (file == NULL) { + return; + } + + while (fgets(buf, sizeof(buf), file) != NULL) { + printf("%s", buf); + } + + fclose(file); +} + int main(int argc, char **argv) { @@ -442,7 +461,7 @@ main(int argc, char **argv) running = 1; bell_fd = open("/dev/beep", O_WRONLY); - puts(WELCOME); + dump_file("/etc/motd"); while (running) { printf(PROMPT, getlogin()); |