summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-07-25 03:30:40 -0400
committerIan Moffett <ian@osmora.org>2025-07-25 03:30:40 -0400
commit71cb1ceaaa894f642e2d294684d6ac83e965137a (patch)
tree522419ac429635d408d0c0a3740060ee61b22cce
parenteba141e6dcef379f3be50e3e2a5a1e4bfad9131a (diff)
usr: osh: Print banner from /etc/motd
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--etc/motd4
-rw-r--r--usr.bin/osh/osh.c21
2 files changed, 24 insertions, 1 deletions
diff --git a/etc/motd b/etc/motd
new file mode 100644
index 0000000..62718f4
--- /dev/null
+++ b/etc/motd
@@ -0,0 +1,4 @@
+:::::::::::::::::::::::::::::::::::::::
+:: OSMORA GATEWAY ~ Every key echos ::
+:: ..... Proceed with purpose ..... ::
+:::::::::::::::::::::::::::::::::::::::
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());