0 | |
From 438763b6e231410b95b5e352feb65c63cd54de6a Mon Sep 17 00:00:00 2001
|
1 | |
From: Julien Cristau <jcristau@debian.org>
|
2 | |
Date: Fri, 7 Nov 2014 16:19:57 +0000
|
3 | |
Subject: [PATCH] If we have man-db, don't try and emulate man's pipeline
|
4 | |
|
5 | |
Just let man itself do the formatting / zsoelim / ... dance.
|
6 | |
|
7 | |
Debian bug#764792 <https://bugs.debian.org/764792>
|
8 | |
|
9 | |
Signed-off-by: Julien Cristau <jcristau@debian.org>
|
10 | |
---
|
11 | |
xman/configure.ac | 5 +++++
|
12 | |
xman/misc.c | 8 ++++++++
|
13 | |
2 files changed, 13 insertions(+)
|
14 | |
|
15 | |
diff --git a/xman/configure.ac b/xman/configure.ac
|
16 | |
index 9a80cbb..8bb44f2 100644
|
17 | |
--- a/xman/configure.ac
|
18 | |
+++ b/xman/configure.ac
|
19 | |
@@ -44,6 +44,11 @@ if test "x$GROFF" = "xfound" ; then
|
20 | |
AC_DEFINE([HAS_GROFF], 1, [Define to 1 if you have the groff package.])
|
21 | |
fi
|
22 | |
|
23 | |
+AC_CHECK_PROG([MANDB], [mandb], [yes], [no])
|
24 | |
+if test x"$MANDB" = xyes; then
|
25 | |
+ AC_DEFINE([HAVE_MANDB], 1, [Define if the man implementation is man-db])
|
26 | |
+fi
|
27 | |
+
|
28 | |
AC_CHECK_FUNCS([mkstemp])
|
29 | |
|
30 | |
AC_ARG_WITH(helpdir,
|
31 | |
diff --git a/xman/misc.c b/xman/misc.c
|
32 | |
index 06891cd..da8744a 100644
|
33 | |
--- a/xman/misc.c
|
34 | |
+++ b/xman/misc.c
|
35 | |
@@ -661,6 +661,13 @@ static Boolean
|
36 | |
ConstructCommand(char *cmdbuf, const char *path,
|
37 | |
const char *filename, const char *tempfile)
|
38 | |
{
|
39 | |
+#ifdef HAVE_MANDB
|
40 | |
+ int used = snprintf(cmdbuf, BUFSIZ, "man -l %s > %s 2>/dev/null",
|
41 | |
+ filename, tempfile);
|
42 | |
+ if (used >= BUFSIZ - 1)
|
43 | |
+ return FALSE;
|
44 | |
+ return TRUE;
|
45 | |
+#else
|
46 | |
/* The original code did the following to produce a command line:
|
47 | |
* sprintf(cmdbuf,"cd %s ; %s %s %s > %s %s", path, TBL,
|
48 | |
* filename, FORMAT, man_globals->tempfile, "2> /dev/null");
|
49 | |
@@ -783,6 +790,7 @@ ConstructCommand(char *cmdbuf, const char *path,
|
50 | |
return (FALSE);
|
51 | |
|
52 | |
return (TRUE);
|
53 | |
+#endif /* man-db */
|
54 | |
}
|
55 | |
#endif /* HANDLE_ROFFSEQ */
|
56 | |
|
57 | |
--
|
58 | |
2.1.1
|
59 | |
|