diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-02-16 18:57:53 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-02-16 19:16:52 +0100 |
commit | 226b8a143d5632180bef05f728bb497b8318294f (patch) | |
tree | cfe150cb6fdf78ce051769c0c9fa6a287bf3ef42 | |
parent | e880b1fea8442b623d45a8f62227fc35cbcac7ec (diff) | |
download | busybox-w32-226b8a143d5632180bef05f728bb497b8318294f.tar.gz busybox-w32-226b8a143d5632180bef05f728bb497b8318294f.tar.bz2 busybox-w32-226b8a143d5632180bef05f728bb497b8318294f.zip |
ash: main: Print \n upon EOF (CTRL-D) when run interactively
Upstream comment:
Date: Fri, 7 Sep 2018 10:34:14 +0200
main: Print \n upon EOF (CTRL-D) when run interactively
Exiting dash via a ^D instead of with "exit" causes dash to forget to
print a newline.
sh-3.1$ sh
sh-3.1$ ^D
sh-3.1$ dash
$ sh-3.1$
It is more neat and tidy to send a newline similarly to what bash does,
so it doesn't make the next prompt of the parent shell look ugly.
Suggested by jidanni.
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
[reworded the patch description]
Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
Bug-Debian: http://bugs.debian.org/476422
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index 138f19abd..3958db123 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -13302,8 +13302,12 @@ cmdloop(int top) | |||
13302 | if (!top || numeof >= 50) | 13302 | if (!top || numeof >= 50) |
13303 | break; | 13303 | break; |
13304 | if (!stoppedjobs()) { | 13304 | if (!stoppedjobs()) { |
13305 | if (!Iflag) | 13305 | if (!Iflag) { |
13306 | if (iflag) { | ||
13307 | newline_and_flush(stderr); | ||
13308 | } | ||
13306 | break; | 13309 | break; |
13310 | } | ||
13307 | out2str("\nUse \"exit\" to leave shell.\n"); | 13311 | out2str("\nUse \"exit\" to leave shell.\n"); |
13308 | } | 13312 | } |
13309 | numeof++; | 13313 | numeof++; |