Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 104593 | Differences between
and this patch

Collapse All | Expand All

(-)man-1.6b/configure.nroff (-13 / +6 lines)
Lines 405-414 Link Here
405
  done
405
  done
406
  troff=""
406
  troff=""
407
  nroff=""
407
  nroff=""
408
  jnroff=""
409
  eqn=""
408
  eqn=""
410
  neqn=""
409
  neqn=""
411
  jneqn=""
412
  tbl=""
410
  tbl=""
413
  col=""
411
  col=""
414
  vgrind=""
412
  vgrind=""
Lines 467-491 Link Here
467
  then
465
  then
468
    if test $Fnroff = "missing"
466
    if test $Fnroff = "missing"
469
    then
467
    then
470
      nroff="nroff -Tlatin1 -mandoc"
468
      nroff="nroff --legacy NROFF_OLD_CHARSET -mandoc 2>/dev/null"
471
    else
469
    else
472
      nroff="$Fnroff -Tlatin1 -mandoc"
470
      nroff="$Fnroff --legacy NROFF_OLD_CHARSET -mandoc 2>/dev/null"
473
    fi
471
    fi
474
    troff="troff -mandoc"
472
    troff="troff -mandoc"
475
    echo "Warning: could not find groff"
473
    echo "Warning: could not find groff"
476
  else
474
  else
477
    if test $Fnroff = "missing"
475
    if test $Fnroff = "missing"
478
    then
476
    then
479
      nroff="$Fgroff -Tlatin1 -mandoc"
477
      nroff="$Fgroff -Tutf8 -mandoc"
480
    else
478
    else
481
      nroff="$Fnroff -Tlatin1 -mandoc"
479
      nroff="$Fnroff --legacy NROFF_OLD_CHARSET -mandoc 2>/dev/null"
482
    fi
480
    fi
483
    troff="$Fgroff -Tps -mandoc"
481
    troff="$Fgroff -Tps -mandoc"
484
    jnroff="$Fgroff -Tnippon -mandocj"
485
  fi
482
  fi
486
  eqn="$Fgeqn -Tps"
483
  eqn="$Fgeqn -Tps"
487
  neqn="$Fgeqn -Tlatin1"
484
  neqn="$Fgeqn -Tutf8"
488
  jneqn="$Fgeqn -Tnippon"
489
  tbl="$Fgtbl"
485
  tbl="$Fgtbl"
490
  col="$Fcol"
486
  col="$Fcol"
491
  vgrind="$Fvgrind"
487
  vgrind="$Fvgrind"
Lines 518-524 Link Here
518
  cat="$Fcat"
514
  cat="$Fcat"
519
  awk="$Fawk"
515
  awk="$Fawk"
520
516
521
  FILTERS="troff nroff jnroff eqn neqn jneqn tbl col vgrind refer grap pic pager browser htmlpager cmp cat awk"
517
  FILTERS="troff nroff eqn neqn tbl col vgrind refer grap pic pager browser htmlpager cmp cat awk"
522
fi
518
fi
523
519
524
# Note: older nroff gives an error message for -c
520
# Note: older nroff gives an error message for -c
Lines 526-532 Link Here
526
if [ "x$set_compatibility_mode_for_colored_groff" = "xtrue" ]; then
522
if [ "x$set_compatibility_mode_for_colored_groff" = "xtrue" ]; then
527
    troff="$troff -c"
523
    troff="$troff -c"
528
    nroff="$nroff -c"
524
    nroff="$nroff -c"
529
    jnroff="$jnroff -c"
530
fi
525
fi
531
526
532
if [ x$default = x ]; then
527
if [ x$default = x ]; then
Lines 1281-1290 Link Here
1281
s,@LIBOBJS@,$LIBOBJS,
1276
s,@LIBOBJS@,$LIBOBJS,
1282
s,@troff@,$troff,
1277
s,@troff@,$troff,
1283
s,@nroff@,$nroff,
1278
s,@nroff@,$nroff,
1284
s,@jnroff@,$jnroff,
1285
s,@eqn@,$eqn,
1279
s,@eqn@,$eqn,
1286
s,@neqn@,$neqn,
1280
s,@neqn@,$neqn,
1287
s,@jneqn@,$jneqn,
1288
s,@tbl@,$tbl,
1281
s,@tbl@,$tbl,
1289
s,@nocol@,$nocol,
1282
s,@nocol@,$nocol,
1290
s,@pcol@,$pcol,
1283
s,@pcol@,$pcol,
(-)man-1.6b/src/man.c.nroff (-31 / +81 lines)
Lines 80-87 Link Here
80
int fsstnd;
80
int fsstnd;
81
int noautopath;
81
int noautopath;
82
int nocache;
82
int nocache;
83
static int is_japanese;
83
84
static char *language;
85
static char **section_list;
84
static char **section_list;
86
85
87
#ifdef DO_COMPRESS
86
#ifdef DO_COMPRESS
Lines 442-448 Link Here
442
}
441
}
443
442
444
static int
443
static int
445
is_lang_page (char *lang, const char *file) {
444
is_lang_page (const char *lang, const char *file) {
446
	char lang_path[16] = "";
445
	char lang_path[16] = "";
447
446
448
	snprintf(lang_path, sizeof(lang_path), "/%s/", lang);
447
	snprintf(lang_path, sizeof(lang_path), "/%s/", lang);
Lines 457-478 Link Here
457
	return 0;
456
	return 0;
458
}
457
}
459
458
459
/* we need to pass, as a parameter, what the character set of a man page
460
 * is likely to be if it is not utf-8, so that nroff can iconv it to utf-8.
461
 *
462
 * the character set/encoding is "guessed" based on the most common non-Unicode
463
 * encoding used for man pages.
464
 */
465
466
typedef struct {
467
    const char *lang;
468
    const char *encoding;
469
} lc2enc_t;
470
471
static const lc2enc_t lc2enc[] = {
472
    { "C",     "ASCII"      },
473
    { "de",    "ISO-8859-1" },
474
    { "en",    "ISO-8859-1" },
475
    { "es",    "ISO-8859-1" },
476
    { "fr",    "ISO-8859-1" },
477
    { "it",    "ISO-8859-1" },
478
    { "pt",    "ISO-8859-1" },
479
    { "hr",    "ISO-8859-2" },
480
    { "cs",    "ISO-8859-2" },
481
    { "et",    "ISO-8859-2" },
482
    { "hu",    "ISO-8859-2" },
483
    { "lv",    "ISO-8859-2" },
484
    { "lt",    "ISO-8859-2" },
485
    { "pl",    "ISO-8859-2" },
486
    { "ro",    "ISO-8859-2" },
487
    { "sk",    "ISO-8859-2" },
488
    { "sl",    "ISO-8859-2" },
489
    { "bg",    "KOI8-R"     },
490
    { "be",    "KOI8-R"     },
491
    { "mk",    "KOI8-R"     },
492
    { "ru",    "KOI8-R"     },
493
    { "sh",    "KOI8-R"     },
494
    { "uk",    "KOI8-R"     },
495
    { "el",    "ISO-8859-7" },
496
    { "tr",    "ISO-8859-9" },
497
    { "ja",    "EUC-JP"     },
498
    { "ko",    "EUC-KR"     },
499
    { "zh_CN", "GB2312"     },
500
    { "zh_HK", "BIG5"       },
501
    { "zh_TW", "BIG5"       },
502
    { NULL }
503
};
504
505
static const char *
506
get_legacy_encoding(const char *file) {
507
    const lc2enc_t *ptr;
508
509
    for (ptr = lc2enc; ptr->lang != NULL; ptr++) {
510
        if (is_lang_page(ptr->lang, file)) {
511
            return ptr->encoding;
512
        }
513
    }
514
    return "ISO-8859-1";
515
}
516
460
static int
517
static int
461
parse_roff_directive (char *cp, const char *file, char *buf, int buflen) {
518
parse_roff_directive (char *cp, const char *file, char *buf, int buflen) {
462
     char c;
519
     char c;
463
     int tbl_found = 0;
520
     int tbl_found = 0;
464
     int use_jroff;
465
466
     use_jroff = (is_japanese &&
467
		   (strstr(file, "/jman/") || is_lang_page(language, file)));
468
521
469
     while ((c = *cp++) != '\0') {
522
     while ((c = *cp++) != '\0') {
470
	  switch (c) {
523
	  switch (c) {
471
	  case 'e':
524
	  case 'e':
472
	       if (debug)
525
	       if (debug)
473
		    gripe (FOUND_EQN);
526
		    gripe (FOUND_EQN);
474
	       add_directive((do_troff ? "EQN" : use_jroff ? "JNEQN": "NEQN"),
527
	       add_directive((do_troff ? "EQN" : "NEQN"), file, buf, buflen);
475
			     file, buf, buflen);
476
	       break;
528
	       break;
477
529
478
	  case 'g':
530
	  case 'g':
Lines 520-528 Link Here
520
     if (*buf == 0)
572
     if (*buf == 0)
521
	  return 1;
573
	  return 1;
522
574
523
     add_directive (do_troff ? "TROFF" : use_jroff ? "JNROFF" : "NROFF",
575
     add_directive (do_troff ? "TROFF" : "NROFF", "", buf, buflen);
524
		    "", buf, buflen);
525
576
577
     if (!do_troff && strstr(buf, "NROFF_OLD_CHARSET") != NULL) {
578
         const char *encoding = NULL;
579
         size_t len = strlen("NROFF_OLD_CHARSET");
580
         char *p = strstr(buf, "NROFF_OLD_CHARSET");
581
582
         if (debug) {
583
             fprintf(stderr, "\nfound '%s' in path\n", "NROFF_OLD_CHARSET");
584
         }
585
         encoding = get_legacy_encoding(file);
586
         if (debug) {
587
             fprintf(stderr, "\nold charset of '%s' is '%s'\n", file, encoding);
588
         }
589
         if (strlen(encoding) < len) {
590
             memmove(p, p + len, strlen(p + len) + 1);
591
             memmove(p + strlen(encoding), p, strlen(p) + 1);
592
             memcpy(p, encoding, strlen(encoding));
593
         }
594
     }
595
     
526
     if (tbl_found && !do_troff && *getval("COL"))
596
     if (tbl_found && !do_troff && *getval("COL"))
527
	  add_directive ("COL", "", buf, buflen);
597
	  add_directive ("COL", "", buf, buflen);
528
598
Lines 1181-1202 Link Here
1181
     return status;
1251
     return status;
1182
}
1252
}
1183
1253
1184
/* Special code for Japanese (to pick jnroff instead of nroff, etc.) */
1185
static void
1186
setlang(void) {
1187
	char *lang;
1188
1189
	/* We use getenv() instead of setlocale(), because of
1190
	   glibc 2.1.x security policy for SetUID/SetGID binary. */
1191
	if ((lang = getenv("LANG")) == NULL &&
1192
	    (lang = getenv("LC_ALL")) == NULL &&
1193
	    (lang = getenv("LC_CTYPE")) == NULL)
1194
		/* nothing */;
1195
1196
	language = lang;
1197
	is_japanese = (lang && strncmp(lang, "ja", 2) == 0);
1198
}
1199
1200
/*
1254
/*
1201
 * Handle the apropos option.  Cheat by using another program.
1255
 * Handle the apropos option.  Cheat by using another program.
1202
 */
1256
 */
Lines 1263-1272 Link Here
1263
     setlocale(LC_MESSAGES, "");
1317
     setlocale(LC_MESSAGES, "");
1264
#endif
1318
#endif
1265
1319
1266
     /* No doubt we'll need some generic language code here later.
1267
	For the moment only Japanese support. */
1268
     setlang();
1269
1270
     /* Handle /usr/man/man1.Z/name.1 nonsense from HP */
1320
     /* Handle /usr/man/man1.Z/name.1 nonsense from HP */
1271
     dohp = getenv("MAN_HP_DIREXT");		/* .Z */
1321
     dohp = getenv("MAN_HP_DIREXT");		/* .Z */
1272
1322
(-)man-1.6b/src/man.conf.in.nroff (-3 / +1 lines)
Lines 86-99 Link Here
86
# (Maybe - but today I need -Tlatin1 to prevent double conversion to utf8.)
86
# (Maybe - but today I need -Tlatin1 to prevent double conversion to utf8.)
87
#
87
#
88
# If you have a new troff (version 1.18.1?) and its colored output
88
# If you have a new troff (version 1.18.1?) and its colored output
89
# causes problems, add the -c option to TROFF, NROFF, JNROFF.
89
# causes problems, add the -c option to TROFF, NROFF.
90
#
90
#
91
TROFF		@troff@
91
TROFF		@troff@
92
NROFF		@nroff@
92
NROFF		@nroff@
93
JNROFF		@jnroff@
94
EQN		@eqn@
93
EQN		@eqn@
95
NEQN		@neqn@
94
NEQN		@neqn@
96
JNEQN		@jneqn@
97
TBL		@tbl@
95
TBL		@tbl@
98
@nocol@COL		@col@
96
@nocol@COL		@col@
99
REFER		@refer@
97
REFER		@refer@
(-)man-1.6b/src/paths.h.in.nroff (-2 lines)
Lines 16-25 Link Here
16
    { "WHATIS",   "@whatis@" },
16
    { "WHATIS",   "@whatis@" },
17
    { "TROFF",	"@troff@" },
17
    { "TROFF",	"@troff@" },
18
    { "NROFF",	"@nroff@" },
18
    { "NROFF",	"@nroff@" },
19
    { "JNROFF",	"@jnroff@" },
20
    { "EQN",	"@eqn@" },
19
    { "EQN",	"@eqn@" },
21
    { "NEQN",	"@neqn@" },
20
    { "NEQN",	"@neqn@" },
22
    { "JNEQN",	"@jneqn@" },
23
    { "TBL",	"@tbl@" },
21
    { "TBL",	"@tbl@" },
24
    { "COL",	"@pcol@" },
22
    { "COL",	"@pcol@" },
25
    { "REFER",	"@refer@" },
23
    { "REFER",	"@refer@" },

Return to bug 104593