projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b24e55d
)
ttysize: if stdin is not tty, try stdout, then stderr
author
Denys Vlasenko
<vda.linux@googlemail.com>
Sun, 16 Jul 2017 18:36:48 +0000
(20:36 +0200)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Sun, 16 Jul 2017 18:36:48 +0000
(20:36 +0200)
function old new delta
ttysize_main 135 175 +40
packed_usage 31686 31672 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/ttysize.c
patch
|
blob
|
history
diff --git
a/miscutils/ttysize.c
b/miscutils/ttysize.c
index 135ce853524389f6cbc63c9e886071f66002e50a..cba65b148e74ce0e0412357e240f254e00a52005 100644
(file)
--- a/
miscutils/ttysize.c
+++ b/
miscutils/ttysize.c
@@
-25,7
+25,7
@@
//usage:#define ttysize_trivial_usage
//usage: "[w] [h]"
//usage:#define ttysize_full_usage "\n\n"
-//usage: "Print dimension
(s) of stdin's terminal, on error return 80x25
"
+//usage: "Print dimension
s of stdin tty, or 80x24
"
#include "libbb.h"
@@
-37,7
+37,10
@@
int ttysize_main(int argc UNUSED_PARAM, char **argv)
w = 80;
h = 24;
- if (!ioctl(0, TIOCGWINSZ, &wsz)) {
+ if (ioctl(0, TIOCGWINSZ, &wsz) == 0
+ || ioctl(1, TIOCGWINSZ, &wsz) == 0
+ || ioctl(2, TIOCGWINSZ, &wsz) == 0
+ ) {
w = wsz.ws_col;
h = wsz.ws_row;
}