~sircmpwn/gmni

5f4c61726268f4f56e346ba1cd7089e9a21d407c — OndÅ™ej Fiala 2 years ago 0796563
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.
1 files changed, 1 insertions(+), 0 deletions(-)

M src/gmnlm.c
M src/gmnlm.c => src/gmnlm.c +1 -0
@@ 553,6 553,7 @@ do_prompts(const char *prompt, struct browser *browser)
	char *in = NULL;
	ssize_t n = getline(&in, &l, browser->tty);
	if (n == -1 && feof(browser->tty)) {
		fputc('\n', browser->tty);
		result = PROMPT_QUIT;
		goto exit;
	}