aboutsummaryrefslogtreecommitdiff
path: root/shell/shell_common.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-05-14 09:12:41 +0100
committerRon Yorston <rmy@pobox.com>2020-05-14 09:12:41 +0100
commit1d2a15e040b272155d3e40b597292a56de540e7d (patch)
tree434742eb6a06999214f4d81eadc88893021dc45d /shell/shell_common.c
parentdb46c292750493d2e98a21ec24a8a407fd8b3207 (diff)
downloadbusybox-w32-1d2a15e040b272155d3e40b597292a56de540e7d.tar.gz
busybox-w32-1d2a15e040b272155d3e40b597292a56de540e7d.tar.bz2
busybox-w32-1d2a15e040b272155d3e40b597292a56de540e7d.zip
ash: proper accounting for backspaces in the read builtin
When the '-n' option of the 'read' builtin is used we need to account for backspaces: increase 'nchars' when backspace removes a character from the buffer.
Diffstat (limited to 'shell/shell_common.c')
-rw-r--r--shell/shell_common.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 9092a8e2b..e50a79b78 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -248,6 +248,7 @@ shell_builtin_read(struct builtin_read_params *params)
248 else if (key == '\b') { 248 else if (key == '\b') {
249 if (bufpos > 0) { 249 if (bufpos > 0) {
250 --bufpos; 250 --bufpos;
251 ++nchars;
251 if (!(read_flags & BUILTIN_READ_SILENT)) { 252 if (!(read_flags & BUILTIN_READ_SILENT)) {
252 printf("\b \b"); 253 printf("\b \b");
253 } 254 }