summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-06-24 03:07:47 -0400
committerIan Moffett <ian@osmora.org>2025-06-24 03:07:47 -0400
commite61f8826a78ce9558416a48275729b6bdcabfb7c (patch)
treea5da5eef604898ceb5acb0b0de7a124e7ca8c300
parent8ce4282e92455e9da19c9fc1f7d6bc313567717f (diff)
usr.bin: osh: Skip blank newlines in scripts
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--usr.bin/osh/osh.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/osh/osh.c b/usr.bin/osh/osh.c
index d458173..47ea695 100644
--- a/usr.bin/osh/osh.c
+++ b/usr.bin/osh/osh.c
@@ -310,6 +310,11 @@ open_script(const char *pathname)
}
while (read(fd, &c, 1) > 0) {
+ /* Skip blank newlines */
+ if (c == '\n' && buf_i == 0) {
+ continue;
+ }
+
if (buf_i >= sizeof(buf) - 1) {
buf_i = 0;
}