aboutsummaryrefslogtreecommitdiff
path: root/shell/shell_common.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-07-12 11:52:06 +0100
committerRon Yorston <rmy@pobox.com>2023-07-12 11:52:06 +0100
commit2a4b086d4848616306f97f6378e0f10a48d41929 (patch)
tree361555080da82c8aa1b35aed25e645354c282f1a /shell/shell_common.c
parent63f2f555277c8a4b2b992367aa26d497931deaeb (diff)
downloadbusybox-w32-2a4b086d4848616306f97f6378e0f10a48d41929.tar.gz
busybox-w32-2a4b086d4848616306f97f6378e0f10a48d41929.tar.bz2
busybox-w32-2a4b086d4848616306f97f6378e0f10a48d41929.zip
ash: properly echo console input to 'read' built-in
The 'read' shell built-in echoed console input to stdout. Echo directly to the console instead. Costs 124-136 bytes.
Diffstat (limited to 'shell/shell_common.c')
-rw-r--r--shell/shell_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 716d3aebb..99e56a050 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -235,7 +235,7 @@ shell_builtin_read(struct builtin_read_params *params)
235 --bufpos; 235 --bufpos;
236 ++nchars; 236 ++nchars;
237 if (!(read_flags & BUILTIN_READ_SILENT)) { 237 if (!(read_flags & BUILTIN_READ_SILENT)) {
238 printf("\b \b"); 238 console_write("\b \b", 3);
239 } 239 }
240 } 240 }
241 goto loop; 241 goto loop;
@@ -243,7 +243,7 @@ shell_builtin_read(struct builtin_read_params *params)
243 buffer[bufpos] = key == '\r' ? '\n' : key; 243 buffer[bufpos] = key == '\r' ? '\n' : key;
244 if (!(read_flags & BUILTIN_READ_SILENT)) { 244 if (!(read_flags & BUILTIN_READ_SILENT)) {
245 /* echo input if not in silent mode */ 245 /* echo input if not in silent mode */
246 putchar(buffer[bufpos]); 246 console_write(buffer + bufpos, 1);
247 } 247 }
248 } 248 }
249 else { 249 else {