summaryrefslogtreecommitdiff
path: root/win32/winansi.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-04-03 11:13:10 +0100
committerRon Yorston <rmy@pobox.com>2018-04-03 12:29:01 +0100
commit32f8569a99b948e810266608dd6e3bf9de611df5 (patch)
treeec891c62ed84879a99de960365cc4ba935e02c90 /win32/winansi.c
parent4d8668e4b6bac0d7902dd677d540c700817b094b (diff)
downloadbusybox-w32-32f8569a99b948e810266608dd6e3bf9de611df5.tar.gz
busybox-w32-32f8569a99b948e810266608dd6e3bf9de611df5.tar.bz2
busybox-w32-32f8569a99b948e810266608dd6e3bf9de611df5.zip
win32: improvements to get_terminal_width_height
- move winansi_get_terminal_width_height from winansi.c to ioctl.c, the only caller; - check both stdout and stderr for a connection to a console; - omit unnecessary code in get_terminal_width_height (because the WIN32 implementation ignores the file descriptor).
Diffstat (limited to 'win32/winansi.c')
-rw-r--r--win32/winansi.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/win32/winansi.c b/win32/winansi.c
index ad6016ddc..a8f5dba79 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -596,23 +596,6 @@ int winansi_printf(const char *format, ...)
596 return rv; 596 return rv;
597} 597}
598 598
599int winansi_get_terminal_width_height(struct winsize *win)
600{
601 BOOL ret;
602 CONSOLE_SCREEN_BUFFER_INFO sbi;
603
604 init();
605
606 win->ws_row = 0;
607 win->ws_col = 0;
608 if ((ret=GetConsoleScreenBufferInfo(console, &sbi)) != 0) {
609 win->ws_row = sbi.srWindow.Bottom - sbi.srWindow.Top + 1;
610 win->ws_col = sbi.srWindow.Right - sbi.srWindow.Left + 1;
611 }
612
613 return ret ? 0 : -1;
614}
615
616static int ansi_emulate_write(int fd, const void *buf, size_t count) 599static int ansi_emulate_write(int fd, const void *buf, size_t count)
617{ 600{
618 int rv = 0, i; 601 int rv = 0, i;