aboutsummaryrefslogtreecommitdiff
path: root/patches/0040-mandoc-port-to-musl.patch
blob: 60c503fc1e724f67bfce06fbe1c611135f635864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
Apart from some definitions and includes, this patch also removes the LESS -T
call so that other implementations of LESS (such as busybox) work as well.
diff -upr a/usr.bin/mandoc/chars.c b/usr.bin/mandoc/chars.c
--- a/usr.bin/mandoc/chars.c	2020-02-13 19:16:03.000000000 +0300
+++ b/usr.bin/mandoc/chars.c	2020-10-15 20:28:37.865510442 +0300
@@ -16,6 +16,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <assert.h>
diff -upr a/usr.bin/mandoc/dba.c b/usr.bin/mandoc/dba.c
--- a/usr.bin/mandoc/dba.c	2017-02-09 21:26:17.000000000 +0300
+++ b/usr.bin/mandoc/dba.c	2020-10-15 20:14:07.403360262 +0300
@@ -17,6 +17,7 @@
  * Allocation-based version of the mandoc database, for read-write access.
  * The interface is defined in "dba.h".
  */
+#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <endian.h>
 #include <errno.h>
diff -upr a/usr.bin/mandoc/dbm.c b/usr.bin/mandoc/dbm.c
--- a/usr.bin/mandoc/dbm.c	2019-07-02 01:43:03.000000000 +0300
+++ b/usr.bin/mandoc/dbm.c	2020-10-15 20:15:44.217488475 +0300
@@ -31,6 +31,10 @@
 #include "dbm_map.h"
 #include "dbm.h"
 
+#ifndef EFTYPE
+#define EFTYPE 79
+#endif
+
 struct macro {
 	int32_t	value;
 	int32_t	pages;
diff -upr a/usr.bin/mandoc/dbm_map.c b/usr.bin/mandoc/dbm_map.c
--- a/usr.bin/mandoc/dbm_map.c	2017-02-09 21:26:17.000000000 +0300
+++ b/usr.bin/mandoc/dbm_map.c	2020-10-15 20:16:40.740563806 +0300
@@ -36,6 +36,10 @@
 #include "dbm_map.h"
 #include "dbm.h"
 
+#ifndef EFTYPE
+#define EFTYPE 79
+#endif
+
 static struct stat	 st;
 static char		*dbm_base;
 static int		 ifd;
diff -upr a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
--- a/usr.bin/mandoc/html.c	2020-04-20 15:59:24.000000000 +0300
+++ b/usr.bin/mandoc/html.c	2020-10-15 20:31:07.733706743 +0300
@@ -18,6 +18,7 @@
  * Common functions for mandoc(1) HTML formatters.
  * For use by individual formatters and by the main program.
  */
+#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
diff -upr a/usr.bin/mandoc/mandoc_ohash.c b/usr.bin/mandoc/mandoc_ohash.c
--- a/usr.bin/mandoc/mandoc_ohash.c	2015-10-19 21:58:20.000000000 +0300
+++ b/usr.bin/mandoc/mandoc_ohash.c	2020-10-15 20:22:30.788037370 +0300
@@ -14,6 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <stddef.h>
 #include <stdint.h>
diff -upr a/usr.bin/mandoc/mandoc_xr.c b/usr.bin/mandoc/mandoc_xr.c
--- a/usr.bin/mandoc/mandoc_xr.c	2017-07-03 00:17:12.000000000 +0300
+++ b/usr.bin/mandoc/mandoc_xr.c	2020-10-15 20:22:48.871060409 +0300
@@ -14,6 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <assert.h>
diff -upr a/usr.bin/mandoc/mansearch.c b/usr.bin/mandoc/mansearch.c
--- a/usr.bin/mandoc/mansearch.c	2019-07-02 01:43:03.000000000 +0300
+++ b/usr.bin/mandoc/mansearch.c	2020-10-15 20:23:05.476081586 +0300
@@ -16,6 +16,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include <sys/cdefs.h>
 #include <sys/mman.h>
 #include <sys/types.h>
 
diff -upr a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
--- a/usr.bin/mandoc/roff.c	2020-04-08 14:54:14.000000000 +0300
+++ b/usr.bin/mandoc/roff.c	2020-10-15 20:23:23.988105223 +0300
@@ -17,6 +17,7 @@
  *
  * Implementation of the roff(7) parser for mandoc(1).
  */
+#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <assert.h>
diff -upr a/usr.bin/mandoc/tag.c b/usr.bin/mandoc/tag.c
--- a/usr.bin/mandoc/tag.c	2020-04-19 19:26:11.000000000 +0300
+++ b/usr.bin/mandoc/tag.c	2020-10-15 20:23:39.327124832 +0300
@@ -17,6 +17,7 @@
  * Functions to tag syntax tree nodes.
  * For internal use by mandoc(1) validation modules only.
  */
+#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <assert.h>
diff -up a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
--- a/usr.bin/mandoc/main.c	2020-04-03 01:10:27.000000000 +0300
+++ b/usr.bin/mandoc/main.c	2020-10-17 15:16:29.615721780 +0300
@@ -405,8 +405,10 @@ main(int argc, char *argv[])
 		}
 		if (search.arch == NULL)
 			search.arch = getenv("MACHINE");
+#ifdef MACHINE
 		if (search.arch == NULL)
 			search.arch = MACHINE;
+#endif
 		if (outmode == OUTMODE_ONE)
 			search.firstmatch = 1;
 	}
@@ -1183,7 +1185,9 @@ spawn_pager(struct tag_files *tag_files,
 	char		*argv[MAX_PAGER_ARGS];
 	const char	*pager;
 	char		*cp;
+#ifdef HAVE_LESS_T
 	size_t		 cmdlen;
+#endif
 	int		 argc, use_ofn;
 	pid_t		 pager_pid;
 
@@ -1218,6 +1222,7 @@ spawn_pager(struct tag_files *tag_files,
 	/* For more(1) and less(1), use the tag file. */
 
 	use_ofn = 1;
+#ifdef HAVE_LESS_T
 	if (*tag_files->tfn != '\0' && (cmdlen = strlen(argv[0])) >= 4) {
 		cp = argv[0] + cmdlen - 4;
 		if (strcmp(cp, "less") == 0 || strcmp(cp, "more") == 0) {
@@ -1230,6 +1235,7 @@ spawn_pager(struct tag_files *tag_files,
 			}
 		}
 	}
+#endif
 	if (use_ofn)
 		argv[argc++] = tag_files->ofn;
 	argv[argc] = NULL;