gegl: Update from 0.3.32 to 0.3.34
[termux-packages] / packages / man / term_ascii.c.patch
CommitLineData
385ee34f
FF
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
14f22a3a 4@@ -18,8 +18,10 @@
80c266a7
FF
5 #include "config.h"
6
7 #include <sys/types.h>
8+#include <sys/ioctl.h>
9
10 #include <assert.h>
14f22a3a 11+#include <fcntl.h>
80c266a7 12 #if HAVE_WCHAR
14f22a3a
FF
13 #include <locale.h>
14 #endif
385ee34f 15@@ -64,6 +66,8 @@
80c266a7
FF
16 char *v;
17 #endif
18 struct termp *p;
19+ struct winsize ws;
20+ int tfd;
21
385ee34f
FF
22 p = mandoc_calloc(1, sizeof(*p));
23 p->tcol = p->tcols = mandoc_calloc(1, sizeof(*p->tcol));
24@@ -71,6 +75,15 @@
80c266a7
FF
25
26 p->line = 1;
80c266a7 27 p->defrmargin = p->lastrmargin = 78;
385ee34f 28+
80c266a7
FF
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+ }
385ee34f 36+
80c266a7 37 p->fontq = mandoc_reallocarray(NULL,
385ee34f 38 (p->fontsz = 8), sizeof(*p->fontq));
80c266a7 39 p->fontq[0] = p->fontl = TERMFONT_NONE;