From 2a4b086d4848616306f97f6378e0f10a48d41929 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 12 Jul 2023 11:52:06 +0100 Subject: 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. --- shell/shell_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shell/shell_common.c') 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) --bufpos; ++nchars; if (!(read_flags & BUILTIN_READ_SILENT)) { - printf("\b \b"); + console_write("\b \b", 3); } } goto loop; @@ -243,7 +243,7 @@ shell_builtin_read(struct builtin_read_params *params) buffer[bufpos] = key == '\r' ? '\n' : key; if (!(read_flags & BUILTIN_READ_SILENT)) { /* echo input if not in silent mode */ - putchar(buffer[bufpos]); + console_write(buffer + bufpos, 1); } } else { -- cgit v1.2.3-55-g6feb