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 #include #include 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 #include #include #include 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 #include #include diff -upr 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-15 20:36:12.432111094 +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,6 @@ spawn_pager(struct tag_files *tag_files, char *argv[MAX_PAGER_ARGS]; const char *pager; char *cp; - size_t cmdlen; int argc, use_ofn; pid_t pager_pid; @@ -1218,18 +1219,6 @@ spawn_pager(struct tag_files *tag_files, /* For more(1) and less(1), use the tag file. */ use_ofn = 1; - if (*tag_files->tfn != '\0' && (cmdlen = strlen(argv[0])) >= 4) { - cp = argv[0] + cmdlen - 4; - if (strcmp(cp, "less") == 0 || strcmp(cp, "more") == 0) { - argv[argc++] = mandoc_strdup("-T"); - argv[argc++] = tag_files->tfn; - if (tag_target != NULL) { - argv[argc++] = mandoc_strdup("-t"); - argv[argc++] = tag_target; - use_ofn = 0; - } - } - } if (use_ofn) argv[argc++] = tag_files->ofn; argv[argc] = NULL; 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 #include #include #include 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 #include #include 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 #include #include 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 #include #include 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 #include #include