source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: autoconfiguration test whether less(1) supports the -T option;
@ 2019-03-06 10:19 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-03-06 10:19 UTC (permalink / raw)
  To: source

Log Message:
-----------
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

Modified Files:
--------------
    mandoc:
        configure
        configure.local.example
        main.c

Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/main.c,v
retrieving revision 1.321
retrieving revision 1.322
diff -Lmain.c -Lmain.c -u -p -r1.321 -r1.322
--- main.c
+++ main.c
@@ -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;
Index: configure.local.example
===================================================================
RCS file: /home/cvs/mandoc/mandoc/configure.local.example,v
retrieving revision 1.35
retrieving revision 1.36
diff -Lconfigure.local.example -Lconfigure.local.example -u -p -r1.35 -r1.36
--- configure.local.example
+++ configure.local.example
@@ -304,6 +304,7 @@ HAVE_FTS_COMPARE_CONST=0  # Setting this
 HAVE_GETLINE=0
 HAVE_GETSUBOPT=0
 HAVE_ISBLANK=0
+HAVE_LESS_T=0
 HAVE_MKDTEMP=0
 HAVE_NTOHL=0
 HAVE_O_DIRECTORY=0
Index: configure
===================================================================
RCS file: /home/cvs/mandoc/mandoc/configure,v
retrieving revision 1.68
retrieving revision 1.69
diff -Lconfigure -Lconfigure -u -p -r1.68 -r1.69
--- configure
+++ configure
@@ -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}
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-06 10:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 10:19 mandoc: autoconfiguration test whether less(1) supports the -T option; schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).