[git commit] hush: beautify ^D handling to match ash / bash

Denys Vlasenko vda.linux at googlemail.com
Tue Apr 13 14:42:17 UTC 2021


commit: https://git.busybox.net/busybox/commit/?id=f0c0c56e9b67413ef397876e563c14b02a5deb0f
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
fgetc_interactive                                    227     244     +17

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/hush.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/shell/hush.c b/shell/hush.c
index 7cc678f3c..144ad3edd 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2670,6 +2670,8 @@ static int get_user_input(struct in_str *i)
 	}
 	if (r < 0) {
 		/* EOF/error detected */
+		/* ^D on interactive input goes to next line before exiting: */
+		write(STDOUT_FILENO, "\n", 1);
 		i->p = NULL;
 		i->peek_buf[0] = r = EOF;
 		return r;


More information about the busybox-cvs mailing list