summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-05-14 14:10:23 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-05-14 14:10:23 +0000
commit07e7d95fa2eb24ba9c0d467e05fadd1b50dfe028 (patch)
tree0576b58b54732422b087931a01eee7d84a8b0203
parent89fd4377ad43e25cfc8c8a1209a6a755e31f396c (diff)
downloadmandoc-07e7d95fa2eb24ba9c0d467e05fadd1b50dfe028.tar.gz
Some broken terminal emulators (e.g. sakura) do the equivalent
of "stty cols 0". Ignore that insanity rather than setting conf.output.width to an invalid value and embarking on infinite loops. Issue reported by Jesper Wallin <jesper at ifconfig dot se>, thanks!
-rw-r--r--main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.c b/main.c
index 4083ffaf..4dc73df1 100644
--- a/main.c
+++ b/main.c
@@ -321,7 +321,8 @@ main(int argc, char *argv[])
if (use_pager &&
(conf.output.width == 0 || conf.output.indent == 0) &&
- ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) != -1) {
+ ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) != -1 &&
+ ws.ws_col > 1) {
if (conf.output.width == 0 && ws.ws_col < 79)
conf.output.width = ws.ws_col - 1;
if (conf.output.indent == 0 && ws.ws_col < 66)