| 1 |
--- man-1.6b/configure.nroff 2005-11-10 10:02:58.000000000 +0100
|
| 2 |
+++ man-1.6b/configure 2005-11-10 10:29:55.971053960 +0100
|
| 3 |
@@ -405,10 +405,8 @@
|
| 4 |
done
|
| 5 |
troff=""
|
| 6 |
nroff=""
|
| 7 |
- jnroff=""
|
| 8 |
eqn=""
|
| 9 |
neqn=""
|
| 10 |
- jneqn=""
|
| 11 |
tbl=""
|
| 12 |
col=""
|
| 13 |
vgrind=""
|
| 14 |
@@ -467,25 +465,23 @@
|
| 15 |
then
|
| 16 |
if test $Fnroff = "missing"
|
| 17 |
then
|
| 18 |
- nroff="nroff -Tlatin1 -mandoc"
|
| 19 |
+ nroff="nroff -mandoc 2>/dev/null"
|
| 20 |
else
|
| 21 |
- nroff="$Fnroff -Tlatin1 -mandoc"
|
| 22 |
+ nroff="$Fnroff -mandoc 2>/dev/null"
|
| 23 |
fi
|
| 24 |
troff="troff -mandoc"
|
| 25 |
echo "Warning: could not find groff"
|
| 26 |
else
|
| 27 |
if test $Fnroff = "missing"
|
| 28 |
then
|
| 29 |
- nroff="$Fgroff -Tlatin1 -mandoc"
|
| 30 |
+ nroff="$Fgroff -Tutf8 -mandoc"
|
| 31 |
else
|
| 32 |
- nroff="$Fnroff -Tlatin1 -mandoc"
|
| 33 |
+ nroff="$Fnroff -mandoc 2>/dev/null"
|
| 34 |
fi
|
| 35 |
troff="$Fgroff -Tps -mandoc"
|
| 36 |
- jnroff="$Fgroff -Tnippon -mandocj"
|
| 37 |
fi
|
| 38 |
eqn="$Fgeqn -Tps"
|
| 39 |
- neqn="$Fgeqn -Tlatin1"
|
| 40 |
- jneqn="$Fgeqn -Tnippon"
|
| 41 |
+ neqn="$Fgeqn -Tutf8"
|
| 42 |
tbl="$Fgtbl"
|
| 43 |
col="$Fcol"
|
| 44 |
vgrind="$Fvgrind"
|
| 45 |
@@ -518,7 +514,7 @@
|
| 46 |
cat="$Fcat"
|
| 47 |
awk="$Fawk"
|
| 48 |
|
| 49 |
- FILTERS="troff nroff jnroff eqn neqn jneqn tbl col vgrind refer grap pic pager browser htmlpager cmp cat awk"
|
| 50 |
+ FILTERS="troff nroff eqn neqn tbl col vgrind refer grap pic pager browser htmlpager cmp cat awk"
|
| 51 |
fi
|
| 52 |
|
| 53 |
# Note: older nroff gives an error message for -c
|
| 54 |
@@ -526,7 +522,6 @@
|
| 55 |
if [ "x$set_compatibility_mode_for_colored_groff" = "xtrue" ]; then
|
| 56 |
troff="$troff -c"
|
| 57 |
nroff="$nroff -c"
|
| 58 |
- jnroff="$jnroff -c"
|
| 59 |
fi
|
| 60 |
|
| 61 |
if [ x$default = x ]; then
|
| 62 |
@@ -1281,10 +1276,8 @@
|
| 63 |
s,@LIBOBJS@,$LIBOBJS,
|
| 64 |
s,@troff@,$troff,
|
| 65 |
s,@nroff@,$nroff,
|
| 66 |
-s,@jnroff@,$jnroff,
|
| 67 |
s,@eqn@,$eqn,
|
| 68 |
s,@neqn@,$neqn,
|
| 69 |
-s,@jneqn@,$jneqn,
|
| 70 |
s,@tbl@,$tbl,
|
| 71 |
s,@nocol@,$nocol,
|
| 72 |
s,@pcol@,$pcol,
|
| 73 |
--- man-1.6b/src/man.c.nroff 2005-08-21 01:26:06.000000000 +0200
|
| 74 |
+++ man-1.6b/src/man.c 2005-11-10 10:53:04.778923072 +0100
|
| 75 |
@@ -80,8 +80,7 @@
|
| 76 |
int fsstnd;
|
| 77 |
int noautopath;
|
| 78 |
int nocache;
|
| 79 |
-static int is_japanese;
|
| 80 |
-static char *language;
|
| 81 |
+
|
| 82 |
static char **section_list;
|
| 83 |
|
| 84 |
#ifdef DO_COMPRESS
|
| 85 |
@@ -442,7 +441,7 @@
|
| 86 |
}
|
| 87 |
|
| 88 |
static int
|
| 89 |
-is_lang_page (char *lang, const char *file) {
|
| 90 |
+is_lang_page (const char *lang, const char *file) {
|
| 91 |
char lang_path[16] = "";
|
| 92 |
|
| 93 |
snprintf(lang_path, sizeof(lang_path), "/%s/", lang);
|
| 94 |
@@ -457,22 +456,75 @@
|
| 95 |
return 0;
|
| 96 |
}
|
| 97 |
|
| 98 |
+/* we need to pass, as a parameter, what the character set of a man page
|
| 99 |
+ * is likely to be if it is not utf-8, so that nroff can iconv it to utf-8.
|
| 100 |
+ *
|
| 101 |
+ * the character set/encoding is "guessed" based on the most common non-Unicode
|
| 102 |
+ * encoding used for man pages.
|
| 103 |
+ */
|
| 104 |
+
|
| 105 |
+typedef struct {
|
| 106 |
+ const char *lang;
|
| 107 |
+ const char *encoding;
|
| 108 |
+} lc2enc_t;
|
| 109 |
+
|
| 110 |
+static const lc2enc_t lc2enc[] = {
|
| 111 |
+ { "C", "ASCII" },
|
| 112 |
+ { "de", "ISO-8859-1" },
|
| 113 |
+ { "en", "ISO-8859-1" },
|
| 114 |
+ { "es", "ISO-8859-1" },
|
| 115 |
+ { "fr", "ISO-8859-1" },
|
| 116 |
+ { "it", "ISO-8859-1" },
|
| 117 |
+ { "pt", "ISO-8859-1" },
|
| 118 |
+ { "hr", "ISO-8859-2" },
|
| 119 |
+ { "cs", "ISO-8859-2" },
|
| 120 |
+ { "et", "ISO-8859-2" },
|
| 121 |
+ { "hu", "ISO-8859-2" },
|
| 122 |
+ { "lv", "ISO-8859-2" },
|
| 123 |
+ { "lt", "ISO-8859-2" },
|
| 124 |
+ { "pl", "ISO-8859-2" },
|
| 125 |
+ { "ro", "ISO-8859-2" },
|
| 126 |
+ { "sk", "ISO-8859-2" },
|
| 127 |
+ { "sl", "ISO-8859-2" },
|
| 128 |
+ { "bg", "CP1251" },
|
| 129 |
+ { "be", "KOI8-R" },
|
| 130 |
+ { "mk", "KOI8-R" },
|
| 131 |
+ { "ru", "KOI8-R" },
|
| 132 |
+ { "sh", "KOI8-R" },
|
| 133 |
+ { "uk", "KOI8-R" },
|
| 134 |
+ { "el", "ISO-8859-7" },
|
| 135 |
+ { "tr", "ISO-8859-9" },
|
| 136 |
+ { "ja", "EUC-JP" },
|
| 137 |
+ { "ko", "EUC-KR" },
|
| 138 |
+ { "zh_CN", "GB2312" },
|
| 139 |
+ { "zh_HK", "BIG5" },
|
| 140 |
+ { "zh_TW", "BIG5" },
|
| 141 |
+ { NULL }
|
| 142 |
+};
|
| 143 |
+
|
| 144 |
+static const char *
|
| 145 |
+get_legacy_encoding(const char *file) {
|
| 146 |
+ const lc2enc_t *ptr;
|
| 147 |
+
|
| 148 |
+ for (ptr = lc2enc; ptr->lang != NULL; ptr++) {
|
| 149 |
+ if (is_lang_page(ptr->lang, file)) {
|
| 150 |
+ return ptr->encoding;
|
| 151 |
+ }
|
| 152 |
+ }
|
| 153 |
+ return "ISO-8859-1";
|
| 154 |
+}
|
| 155 |
+
|
| 156 |
static int
|
| 157 |
parse_roff_directive (char *cp, const char *file, char *buf, int buflen) {
|
| 158 |
char c;
|
| 159 |
int tbl_found = 0;
|
| 160 |
- int use_jroff;
|
| 161 |
-
|
| 162 |
- use_jroff = (is_japanese &&
|
| 163 |
- (strstr(file, "/jman/") || is_lang_page(language, file)));
|
| 164 |
|
| 165 |
while ((c = *cp++) != '\0') {
|
| 166 |
switch (c) {
|
| 167 |
case 'e':
|
| 168 |
if (debug)
|
| 169 |
gripe (FOUND_EQN);
|
| 170 |
- add_directive((do_troff ? "EQN" : use_jroff ? "JNEQN": "NEQN"),
|
| 171 |
- file, buf, buflen);
|
| 172 |
+ add_directive((do_troff ? "EQN" : "NEQN"), file, buf, buflen);
|
| 173 |
break;
|
| 174 |
|
| 175 |
case 'g':
|
| 176 |
@@ -520,9 +572,27 @@
|
| 177 |
if (*buf == 0)
|
| 178 |
return 1;
|
| 179 |
|
| 180 |
- add_directive (do_troff ? "TROFF" : use_jroff ? "JNROFF" : "NROFF",
|
| 181 |
- "", buf, buflen);
|
| 182 |
+ add_directive (do_troff ? "TROFF" : "NROFF", "", buf, buflen);
|
| 183 |
|
| 184 |
+ if (!do_troff && strstr(buf, "NROFF_OLD_CHARSET") != NULL) {
|
| 185 |
+ const char *encoding = NULL;
|
| 186 |
+ size_t len = strlen("NROFF_OLD_CHARSET");
|
| 187 |
+ char *p = strstr(buf, "NROFF_OLD_CHARSET");
|
| 188 |
+
|
| 189 |
+ if (debug) {
|
| 190 |
+ fprintf(stderr, "\nfound '%s' in path\n", "NROFF_OLD_CHARSET");
|
| 191 |
+ }
|
| 192 |
+ encoding = get_legacy_encoding(file);
|
| 193 |
+ if (debug) {
|
| 194 |
+ fprintf(stderr, "\nold charset of '%s' is '%s'\n", file, encoding);
|
| 195 |
+ }
|
| 196 |
+ if (strlen(encoding) < len) {
|
| 197 |
+ memmove(p, p + len, strlen(p + len) + 1);
|
| 198 |
+ memmove(p + strlen(encoding), p, strlen(p) + 1);
|
| 199 |
+ memcpy(p, encoding, strlen(encoding));
|
| 200 |
+ }
|
| 201 |
+ }
|
| 202 |
+
|
| 203 |
if (tbl_found && !do_troff && *getval("COL"))
|
| 204 |
add_directive ("COL", "", buf, buflen);
|
| 205 |
|
| 206 |
@@ -1181,22 +1251,6 @@
|
| 207 |
return status;
|
| 208 |
}
|
| 209 |
|
| 210 |
-/* Special code for Japanese (to pick jnroff instead of nroff, etc.) */
|
| 211 |
-static void
|
| 212 |
-setlang(void) {
|
| 213 |
- char *lang;
|
| 214 |
-
|
| 215 |
- /* We use getenv() instead of setlocale(), because of
|
| 216 |
- glibc 2.1.x security policy for SetUID/SetGID binary. */
|
| 217 |
- if ((lang = getenv("LANG")) == NULL &&
|
| 218 |
- (lang = getenv("LC_ALL")) == NULL &&
|
| 219 |
- (lang = getenv("LC_CTYPE")) == NULL)
|
| 220 |
- /* nothing */;
|
| 221 |
-
|
| 222 |
- language = lang;
|
| 223 |
- is_japanese = (lang && strncmp(lang, "ja", 2) == 0);
|
| 224 |
-}
|
| 225 |
-
|
| 226 |
/*
|
| 227 |
* Handle the apropos option. Cheat by using another program.
|
| 228 |
*/
|
| 229 |
@@ -1263,10 +1317,6 @@
|
| 230 |
setlocale(LC_MESSAGES, "");
|
| 231 |
#endif
|
| 232 |
|
| 233 |
- /* No doubt we'll need some generic language code here later.
|
| 234 |
- For the moment only Japanese support. */
|
| 235 |
- setlang();
|
| 236 |
-
|
| 237 |
/* Handle /usr/man/man1.Z/name.1 nonsense from HP */
|
| 238 |
dohp = getenv("MAN_HP_DIREXT"); /* .Z */
|
| 239 |
|
| 240 |
--- man-1.6b/src/man.conf.in.nroff 2005-11-10 10:02:58.000000000 +0100
|
| 241 |
+++ man-1.6b/src/man.conf.in 2005-11-10 10:39:04.442673600 +0100
|
| 242 |
@@ -86,14 +86,12 @@
|
| 243 |
# (Maybe - but today I need -Tlatin1 to prevent double conversion to utf8.)
|
| 244 |
#
|
| 245 |
# If you have a new troff (version 1.18.1?) and its colored output
|
| 246 |
-# causes problems, add the -c option to TROFF, NROFF, JNROFF.
|
| 247 |
+# causes problems, add the -c option to TROFF, NROFF.
|
| 248 |
#
|
| 249 |
TROFF @troff@
|
| 250 |
NROFF @nroff@
|
| 251 |
-JNROFF @jnroff@
|
| 252 |
EQN @eqn@
|
| 253 |
NEQN @neqn@
|
| 254 |
-JNEQN @jneqn@
|
| 255 |
TBL @tbl@
|
| 256 |
@nocol@COL @col@
|
| 257 |
REFER @refer@
|
| 258 |
--- man-1.6b/src/paths.h.in.nroff 2005-08-21 01:26:06.000000000 +0200
|
| 259 |
+++ man-1.6b/src/paths.h.in 2005-11-10 10:38:09.156078440 +0100
|
| 260 |
@@ -16,10 +16,8 @@
|
| 261 |
{ "WHATIS", "@whatis@" },
|
| 262 |
{ "TROFF", "@troff@" },
|
| 263 |
{ "NROFF", "@nroff@" },
|
| 264 |
- { "JNROFF", "@jnroff@" },
|
| 265 |
{ "EQN", "@eqn@" },
|
| 266 |
{ "NEQN", "@neqn@" },
|
| 267 |
- { "JNEQN", "@jneqn@" },
|
| 268 |
{ "TBL", "@tbl@" },
|
| 269 |
{ "COL", "@pcol@" },
|
| 270 |
{ "REFER", "@refer@" },
|