Switch https->http for ftp.videolan.org
[termux-packages] / packages / man / term_ascii.c.patch
... / ...
CommitLineData
1diff -u -r ../mandoc-1.14.3/term_ascii.c ./term_ascii.c
2--- ../mandoc-1.14.3/term_ascii.c 2017-08-05 14:40:22.000000000 +0200
3+++ ./term_ascii.c 2017-08-17 15:58:09.579116114 +0200
4@@ -18,8 +18,10 @@
5 #include "config.h"
6
7 #include <sys/types.h>
8+#include <sys/ioctl.h>
9
10 #include <assert.h>
11+#include <fcntl.h>
12 #if HAVE_WCHAR
13 #include <locale.h>
14 #endif
15@@ -64,6 +66,8 @@
16 char *v;
17 #endif
18 struct termp *p;
19+ struct winsize ws;
20+ int tfd;
21
22 p = mandoc_calloc(1, sizeof(*p));
23 p->tcol = p->tcols = mandoc_calloc(1, sizeof(*p->tcol));
24@@ -71,6 +75,15 @@
25
26 p->line = 1;
27 p->defrmargin = p->lastrmargin = 78;
28+
29+ if ((tfd = open("/dev/tty", O_RDWR, 0)) != -1) {
30+ if (ioctl(tfd, TIOCGWINSZ, &ws) != -1) {
31+ if (ws.ws_col < 80)
32+ p->defrmargin = p->lastrmargin = ws.ws_col - 2;
33+ }
34+ close(tfd);
35+ }
36+
37 p->fontq = mandoc_reallocarray(NULL,
38 (p->fontsz = 8), sizeof(*p->fontq));
39 p->fontq[0] = p->fontl = TERMFONT_NONE;