1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
fix from upstream for building w/out GNU nroff
http://bugs.gentoo.org/309635
Wed Mar 24 11:04:46 GMT 2010 Colin Watson <cjwatson@debian.org>
Fix build regression when GNU_NROFF is undefined (Savannah bug
#29318).
* src/man.c (add_col): New function, split out from
make_display_command.
(make_roff_command): Reinstate tbl/col logic here, as by the time
we get to make_display_command we've forgotten whether tbl was
used.
(make_display_command): Remove tbl/col logic, useless here. Use
add_col.
=== modified file 'src/man.c'
--- src/man.c 2010-03-21 22:05:16 +0000
+++ src/man.c 2010-03-24 11:07:23 +0000
@@ -43,6 +43,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <stdarg.h>
#include <assert.h>
#include <errno.h>
#include <termios.h>
@@ -1406,6 +1407,26 @@
return get_locale_charset ();
}
+static void add_col (pipeline *p, const char *locale_charset, ...)
+{
+ command *cmd;
+ va_list argv;
+ char *col_locale;
+
+ cmd = command_new (COL);
+ va_start (argv, locale_charset);
+ command_argv (cmd, argv);
+ va_end (argv);
+
+ col_locale = find_charset_locale (locale_charset);
+ if (col_locale) {
+ command_setenv (cmd, "LC_CTYPE", col_locale);
+ free (col_locale);
+ }
+
+ pipeline_command (p, cmd);
+}
+
/* Return pipeline to format file to stdout. */
static pipeline *make_roff_command (const char *dir, const char *file,
pipeline *decomp, const char *dbfilters,
@@ -1699,6 +1720,11 @@
!isatty (STDOUT_FILENO))
/* we'll run col later, but prepare for it */
setenv ("GROFF_NO_SGR", "1", 1);
+#ifndef GNU_NROFF
+ /* tbl needs col */
+ else if (using_tbl && !troff && *COL)
+ add_col (p, locale_charset, NULL);
+#endif /* GNU_NROFF */
}
} else {
/* use external formatter script, it takes arguments
@@ -1851,27 +1877,9 @@
*/
const char *man_keep_formatting =
getenv ("MAN_KEEP_FORMATTING");
- command *colcmd = NULL;
if ((!man_keep_formatting || !*man_keep_formatting) &&
!isatty (STDOUT_FILENO))
- colcmd = command_new_args (
- COL, "-b", "-p", "-x", NULL);
-#ifndef GNU_NROFF
- /* tbl needs col */
- else if (using_tbl && !troff && *COL)
- colcmd = command_new (COL);
-#endif /* GNU_NROFF */
-
- if (colcmd) {
- char *col_locale =
- find_charset_locale (locale_charset);
- if (col_locale) {
- command_setenv (colcmd, "LC_CTYPE",
- col_locale);
- free (col_locale);
- }
- pipeline_command (p, colcmd);
- }
+ add_col (p, locale_charset, "-b", "-p", "-x", NULL);
}
if (ascii) {
|