From c6ff39ccc4e52fb860f2bfe436c5ac1c114aadd7 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 20 Feb 2012 10:41:31 +0000 Subject: Add code to find console dimensions in WIN32 --- libbb/xfuncs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libbb') diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index a02a504b0..53c48557d 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -256,7 +256,11 @@ int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *heigh win.ws_col = 0; /* I've seen ioctl returning 0, but row/col is (still?) 0. * We treat that as an error too. */ +#if !ENABLE_PLATFORM_MINGW32 err = ioctl(fd, TIOCGWINSZ, &win) != 0 || win.ws_row == 0; +#else + err = winansi_get_terminal_width_height(&win) == 0; +#endif if (height) *height = wh_helper(win.ws_row, 24, "LINES", &err); if (width) -- cgit v1.2.3-55-g6feb