diff options
author | Ron Yorston <rmy@pobox.com> | 2025-08-07 14:49:11 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2025-08-07 14:49:11 +0100 |
commit | fce38e15f9a43b9695369cf7448840c50c0e97c9 (patch) | |
tree | 9101bf0bb91d6f55839f6d7fb04162e826f5ddaf /win32/ioctl.c | |
parent | 22160c163a91f33684750d887b5bcb6071e0ad36 (diff) | |
download | busybox-w32-fce38e15f9a43b9695369cf7448840c50c0e97c9.tar.gz busybox-w32-fce38e15f9a43b9695369cf7448840c50c0e97c9.tar.bz2 busybox-w32-fce38e15f9a43b9695369cf7448840c50c0e97c9.zip |
stty: fix build for Windows XP
The ioctl() to get the size of the terminal windows used functions
which weren't available on Windows XP. Load these dynamically to
avoid failure.
Adds 160 bytes.
Diffstat (limited to '')
-rw-r--r-- | win32/ioctl.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/win32/ioctl.c b/win32/ioctl.c index dcb96e783..d0ed68d61 100644 --- a/win32/ioctl.c +++ b/win32/ioctl.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include "libbb.h" | 1 | #include "libbb.h" |
2 | #include "lazyload.h" | ||
2 | 3 | ||
3 | #if ENABLE_STTY || ENABLE_TTYSIZE | 4 | #if ENABLE_STTY || ENABLE_TTYSIZE |
4 | static int mingw_get_terminal_width_height(struct winsize *win) | 5 | static int mingw_get_terminal_width_height(struct winsize *win) |
@@ -28,6 +29,15 @@ static int mingw_get_terminal_width_height(struct winsize *win) | |||
28 | static int mingw_set_terminal_width_height(struct winsize *win) | 29 | static int mingw_set_terminal_width_height(struct winsize *win) |
29 | { | 30 | { |
30 | BOOL ret; | 31 | BOOL ret; |
32 | DECLARE_PROC_ADDR(BOOL, GetConsoleScreenBufferInfoEx, HANDLE, | ||
33 | PCONSOLE_SCREEN_BUFFER_INFOEX); | ||
34 | DECLARE_PROC_ADDR(BOOL, SetConsoleScreenBufferInfoEx, HANDLE, | ||
35 | PCONSOLE_SCREEN_BUFFER_INFOEX); | ||
36 | |||
37 | if (!INIT_PROC_ADDR(kernel32.dll, GetConsoleScreenBufferInfoEx)) | ||
38 | return -1; | ||
39 | if (!INIT_PROC_ADDR(kernel32.dll, SetConsoleScreenBufferInfoEx)) | ||
40 | return -1; | ||
31 | 41 | ||
32 | for (int fd = STDOUT_FILENO; fd <= STDERR_FILENO; ++fd) { | 42 | for (int fd = STDOUT_FILENO; fd <= STDERR_FILENO; ++fd) { |
33 | CONSOLE_SCREEN_BUFFER_INFOEX sbi; | 43 | CONSOLE_SCREEN_BUFFER_INFOEX sbi; |