From 4c554a5723b9d14f2e715829c5827a5eba89011d Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Sat, 1 Apr 2023 20:43:38 -0400 Subject: exit on EOF --- interactive.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interactive.c b/interactive.c index 3f753a3..545a52d 100644 --- a/interactive.c +++ b/interactive.c @@ -34,6 +34,11 @@ int sh_interactive(void) }; while (shed(&ed) != NULL) { + if (ed.cur->nread == 1 && ed.cur->buf[0] == CTRL_D) { + printf("\n"); + return 0; + } + struct command *command = sh_parse(ed.cur->buf); if (command) { sh_execute(command); -- cgit v1.2.1