From 10c4a9af585869da2d26c136c49cc79f2ca45e50 Mon Sep 17 00:00:00 2001 From: "Nathan P. Reiner" Date: Fri, 16 Dec 2022 09:33:11 +0100 Subject: implement wstdf --- smash/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'smash/main.c') diff --git a/smash/main.c b/smash/main.c index 0b3dc20..2422363 100644 --- a/smash/main.c +++ b/smash/main.c @@ -15,12 +15,16 @@ int main(int argc, char *argv[], char *envp[]) { char buf[BUFSIZ] = {0}; char prompt[] = "$ "; + u64 line_length; while (1) { write(STDOUT_FD, prompt, cstr_length(prompt)); read(STDIN_FD, buf, 1024); - buf[cstr_length(buf) - 1] = 0; - exec(buf); + line_length = cstr_length(buf); + if (line_length > 1) { + buf[line_length - 1] = 0; + exec(buf); + } clear_buf(buf); } } -- cgit v1.2.3-70-g09d2