commit bf7d1834b811f69514ce9c1ffcce368a1ec24982
parent c35d3d5251bd71c968b70103daa0615b6773dc2a
Author: Ondřej Fiala <temp.xanomes@volny.cz>
Date: Sun, 9 Jan 2022 20:20:46 +0100
gmnlm: output newline when quiting via Control-D
It is common practice to quit programs reading from stdin by sending
EOF to their input. This commit ensures such an exit is functionally
equivalent to a regular exit via the 'q' command.
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/src/gmnlm.c b/src/gmnlm.c
@@ -622,6 +622,7 @@ do_prompts(const char *prompt, struct browser *browser)
size_t l = 0;
ssize_t n = getline(&in, &l, browser->tty);
if (n == -1 && feof(browser->tty)) {
+ fputc('\n', browser->tty);
result = PROMPT_QUIT;
goto exit;
}