aboutsummaryrefslogtreecommitdiff
path: root/libbb
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 /libbb
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 'libbb')
-rw-r--r--libbb/xfuncs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index e8c027f17..f2112aec9 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -268,6 +268,7 @@ int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *heigh
268 int err; 268 int err;
269 int close_me = -1; 269 int close_me = -1;
270 270
271#if !ENABLE_PLATFORM_MINGW32
271 if (fd == -1) { 272 if (fd == -1) {
272 if (isatty(STDOUT_FILENO)) 273 if (isatty(STDOUT_FILENO))
273 fd = STDOUT_FILENO; 274 fd = STDOUT_FILENO;
@@ -280,6 +281,7 @@ int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *heigh
280 else 281 else
281 close_me = fd = open("/dev/tty", O_RDONLY); 282 close_me = fd = open("/dev/tty", O_RDONLY);
282 } 283 }
284#endif
283 285
284 win.ws_row = 0; 286 win.ws_row = 0;
285 win.ws_col = 0; 287 win.ws_col = 0;