diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-03-15 12:42:34 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-03-15 12:42:34 -0400 |
commit | 4f02abda506190ca020f7758a2177aa6c5035c64 (patch) | |
tree | f97c2fbdf3e08ab7bdd9b0f4035d7b69976b17de /interactive.c | |
parent | c4593efbced8d1d5cae004975f6bd7b91904810c (diff) |
really don't crash on empty input
Diffstat (limited to 'interactive.c')
-rw-r--r-- | interactive.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/interactive.c b/interactive.c index c429513..6db84b0 100644 --- a/interactive.c +++ b/interactive.c @@ -45,21 +45,20 @@ int sh_interactive(void) break; } - if (!strcmp(cmdline, "\n")) { - free(cmdline); - continue; - } - struct command *command = sh_parse(cmdline); + #if 0 while (command == NULL) { /* append more text */ /* attempt parsing again */ } + #endif - sh_execute(command); + if (command) { + sh_execute(command); + sh_freecmd(command); + } free(cmdline); - sh_freecmd(command); } return 0; |