aboutsummaryrefslogtreecommitdiff
path: root/smash/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'smash/main.c')
-rw-r--r--smash/main.c8
1 files changed, 6 insertions, 2 deletions
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);
}
}