aboutsummaryrefslogtreecommitdiff
path: root/win32
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 /win32
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 'win32')
-rw-r--r--win32/winansi.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/win32/winansi.c b/win32/winansi.c
index 818ab1793..bc3e69163 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -1405,3 +1405,14 @@ BOOL readConsoleInput_utf8(HANDLE h, INPUT_RECORD *r, DWORD len, DWORD *got)
1405 return FALSE; 1405 return FALSE;
1406} 1406}
1407#endif 1407#endif
1408
1409void console_write(const char *str, int len)
1410{
1411 char *buf = xmemdup(str, len);
1412 int fd = _open("CONOUT$", _O_WRONLY);
1413 HANDLE fh = (HANDLE)_get_osfhandle(fd);
1414 charToConBuffA(buf, len);
1415 WriteConsole(fh, buf, len, NULL, NULL);
1416 close(fd);
1417 free(buf);
1418}