diff options
author | Ron Yorston <rmy@pobox.com> | 2012-02-20 10:41:31 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-02-20 10:41:31 +0000 |
commit | c6ff39ccc4e52fb860f2bfe436c5ac1c114aadd7 (patch) | |
tree | f81e95d16640882bd35202370626b1a0808343f7 /win32 | |
parent | 6fe28f11f83d489e8f5904a75a90008ca94c1437 (diff) | |
download | busybox-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.c | 17 |
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 | |||
421 | int 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 | } | ||