summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2015-04-30 23:38:10 +0200
committerAlan Coopersmith <alan.coopersmith@oracle.com>2019-03-03 13:01:31 -0800
commitea5c4d25577b20a459358eff9f2d8a100dcf794f (patch)
treeaa7b92867b1e59b631e8f4db0d984a418794aece
parent6aefab8b5831b52042afc482a50a43e3a4eba5b9 (diff)
If we have man-db, don't try and emulate man's pipeline
Just let man itself do the formatting / zsoelim / ... dance. This became necessary with man-db 2.7.0 moving zsoelim out of $PATH. Debian bug#764792 <https://bugs.debian.org/764792> Signed-off-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--configure.ac5
-rw-r--r--misc.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 8abb5f6..ab6e9ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,11 @@ if test "x$GROFF" = "xfound" ; then
AC_DEFINE([HAS_GROFF], 1, [Define to 1 if you have the groff package.])
fi
+AC_CHECK_PROG([MANDB], [mandb], [yes], [no])
+if test x"$MANDB" = xyes; then
+ AC_DEFINE([HAVE_MANDB], 1, [Define if the man implementation is man-db])
+fi
+
AC_CHECK_FUNCS([mkstemp])
AC_ARG_WITH(helpdir,
diff --git a/misc.c b/misc.c
index 06891cd..da8744a 100644
--- a/misc.c
+++ b/misc.c
@@ -661,6 +661,13 @@ static Boolean
ConstructCommand(char *cmdbuf, const char *path,
const char *filename, const char *tempfile)
{
+#ifdef HAVE_MANDB
+ int used = snprintf(cmdbuf, BUFSIZ, "man -l %s > %s 2>/dev/null",
+ filename, tempfile);
+ if (used >= BUFSIZ - 1)
+ return FALSE;
+ return TRUE;
+#else
/* The original code did the following to produce a command line:
* sprintf(cmdbuf,"cd %s ; %s %s %s > %s %s", path, TBL,
* filename, FORMAT, man_globals->tempfile, "2> /dev/null");
@@ -783,6 +790,7 @@ ConstructCommand(char *cmdbuf, const char *path,
return (FALSE);
return (TRUE);
+#endif /* man-db */
}
#endif /* HANDLE_ROFFSEQ */