diff options
Diffstat (limited to 'smash')
| -rw-r--r-- | smash/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/smash/main.c b/smash/main.c index ca7d4fa..ad28e6d 100644 --- a/smash/main.c +++ b/smash/main.c @@ -2,6 +2,7 @@ #include "../lib/sys/io.h" #include "../lib/cstr/cstr.h" +#include "../lib/sys/dup2.h" #define BUFSIZ 1024 @@ -17,6 +18,8 @@ int main(int argc, char *argv[], char *envp[]) char prompt[] = "$ "; u64 line_length; + + while (1) { write(STDOUT_FD, prompt, cstr_length(prompt)); read(STDIN_FD, buf, 1024); @@ -25,7 +28,7 @@ int main(int argc, char *argv[], char *envp[]) if (line_length == 0) return 0; - if (line_length == 1) { + if (line_length > 1) { buf[line_length - 1] = 0; exec(buf); } |