diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2019-03-06 10:18:58 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2019-03-06 10:18:58 +0000 |
commit | b5f5f41062698eb8dd357156f62bb66194729f8c (patch) | |
tree | a0ac4bb441673493dc0e5a34eb8b5d0b954f145c | |
parent | 885a149feb0216ef4b499931cc4f9fac18549e30 (diff) | |
download | mandoc-b5f5f41062698eb8dd357156f62bb66194729f8c.tar.gz mandoc-b5f5f41062698eb8dd357156f62bb66194729f8c.tar.zst mandoc-b5f5f41062698eb8dd357156f62bb66194729f8c.zip |
autoconfiguration test whether less(1) supports the -T option;
needed for Alpine Linux because it uses busybox less(1) by default;
based on a patch from Daniel Sabogal explained to me by Natanael Copa
-rwxr-xr-x | configure | 18 | ||||
-rw-r--r-- | configure.local.example | 3 | ||||
-rw-r--r-- | main.c | 6 |
3 files changed, 24 insertions, 3 deletions
@@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: configure,v 1.68 2019/03/04 13:01:57 schwarze Exp $ +# $Id: configure,v 1.69 2019/03/06 10:18:58 schwarze Exp $ # # Copyright (c) 2014-2019 Ingo Schwarze <schwarze@openbsd.org> # @@ -65,6 +65,7 @@ HAVE_FTS_COMPARE_CONST= HAVE_GETLINE= HAVE_GETSUBOPT= HAVE_ISBLANK= +HAVE_LESS_T= HAVE_MKDTEMP= HAVE_NANOSLEEP= HAVE_NTOHL= @@ -334,6 +335,20 @@ else runtest fts FTS || true fi +if ismanual "less -T" LESS_T ${HAVE_LESS_T}; then + : +elif less -ET /dev/null test-noop.c 1>/dev/null 2>&3; then + HAVE_LESS_T=1 + echo "tested less -T: yes" 1>&2 + echo "tested less -T: yes" 1>&3 + echo 1>&3 +else + HAVE_LESS_T=0 + echo "tested less -T: no" 1>&2 + echo "tested less -T: no" 1>&3 + echo 1>&3 +fi + # --- wide character and locale support --- if get_locale; then singletest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || \ @@ -462,6 +477,7 @@ cat << __HEREDOC__ #define HAVE_GETLINE ${HAVE_GETLINE} #define HAVE_GETSUBOPT ${HAVE_GETSUBOPT} #define HAVE_ISBLANK ${HAVE_ISBLANK} +#define HAVE_LESS_T ${HAVE_LESS_T} #define HAVE_MKDTEMP ${HAVE_MKDTEMP} #define HAVE_NTOHL ${HAVE_NTOHL} #define HAVE_PLEDGE ${HAVE_PLEDGE} diff --git a/configure.local.example b/configure.local.example index c56cdaa5..4a456aad 100644 --- a/configure.local.example +++ b/configure.local.example @@ -1,4 +1,4 @@ -# $Id: configure.local.example,v 1.35 2019/03/04 13:01:57 schwarze Exp $ +# $Id: configure.local.example,v 1.36 2019/03/06 10:18:58 schwarze Exp $ # # Copyright (c) 2014-2019 Ingo Schwarze <schwarze@openbsd.org> # @@ -304,6 +304,7 @@ HAVE_FTS_COMPARE_CONST=0 # Setting this implies HAVE_FTS=1. HAVE_GETLINE=0 HAVE_GETSUBOPT=0 HAVE_ISBLANK=0 +HAVE_LESS_T=0 HAVE_MKDTEMP=0 HAVE_NTOHL=0 HAVE_O_DIRECTORY=0 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.321 2019/03/04 18:15:06 schwarze Exp $ */ +/* $Id: main.c,v 1.322 2019/03/06 10:18:58 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org> @@ -1161,7 +1161,9 @@ spawn_pager(struct tag_files *tag_files) char *argv[MAX_PAGER_ARGS]; const char *pager; char *cp; +#if HAVE_LESS_T size_t cmdlen; +#endif int argc, use_ofn; pid_t pager_pid; @@ -1193,6 +1195,7 @@ spawn_pager(struct tag_files *tag_files) /* For less(1), use the tag file. */ use_ofn = 1; +#if HAVE_LESS_T if ((cmdlen = strlen(argv[0])) >= 4) { cp = argv[0] + cmdlen - 4; if (strcmp(cp, "less") == 0) { @@ -1205,6 +1208,7 @@ spawn_pager(struct tag_files *tag_files) } } } +#endif if (use_ofn) argv[argc++] = tag_files->ofn; argv[argc] = NULL; |