aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-02-20 10:41:31 +0000
committerRon Yorston <rmy@pobox.com>2012-02-20 10:41:31 +0000
commitc6ff39ccc4e52fb860f2bfe436c5ac1c114aadd7 (patch)
treef81e95d16640882bd35202370626b1a0808343f7 /win32
parent6fe28f11f83d489e8f5904a75a90008ca94c1437 (diff)
downloadbusybox-w32-c6ff39ccc4e52fb860f2bfe436c5ac1c114aadd7.tar.gz
busybox-w32-c6ff39ccc4e52fb860f2bfe436c5ac1c114aadd7.tar.bz2
busybox-w32-c6ff39ccc4e52fb860f2bfe436c5ac1c114aadd7.zip
Add code to find console dimensions in WIN32
Diffstat (limited to 'win32')
-rw-r--r--win32/winansi.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/win32/winansi.c b/win32/winansi.c
index 3276913da..7730fd006 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -417,3 +417,20 @@ int winansi_printf(const char *format, ...)
417 417
418 return rv; 418 return rv;
419} 419}
420
421int winansi_get_terminal_width_height(struct winsize *win)
422{
423 BOOL ret;
424 CONSOLE_SCREEN_BUFFER_INFO sbi;
425
426 init();
427
428 win->ws_row = 0;
429 win->ws_col = 0;
430 if ((ret=GetConsoleScreenBufferInfo(console, &sbi)) != 0) {
431 win->ws_row = sbi.srWindow.Bottom - sbi.srWindow.Top + 1;
432 win->ws_col = sbi.srWindow.Right - sbi.srWindow.Left + 1;
433 }
434
435 return ret;
436}