diff options
| author | Nathan P. Reiner <nathan@nathanreiner.xyz> | 2022-12-16 10:53:26 +0100 |
|---|---|---|
| committer | Nathan P. Reiner <nathan@nathanreiner.xyz> | 2022-12-16 10:53:26 +0100 |
| commit | 40447910210e9f822d87f080e24811e66232fd14 (patch) | |
| tree | 5de39568b60022c5ca81ab60ea045a2f00af1ea6 | |
| parent | 94252fadadc5f49bf15ce3533372155f360b58ff (diff) | |
fix stupid issue
| -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); } |