summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/man
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-09-30 11:00:04 +0000
committerru <ru@FreeBSD.org>2002-09-30 11:00:04 +0000
commit6ceaeda0510b8681c00452255b93d9129a5d0808 (patch)
tree3660e230c8fb2ff2e9194344b5cc986b49aa2c8c /gnu/usr.bin/man
parentf162697f7c77dad5b4c7c425c7bb8928ba756d96 (diff)
downloadFreeBSD-src-6ceaeda0510b8681c00452255b93d9129a5d0808.zip
FreeBSD-src-6ceaeda0510b8681c00452255b93d9129a5d0808.tar.gz
Pass our idea of a manpage's locale from man(1) down to mdoc(7).
Diffstat (limited to 'gnu/usr.bin/man')
-rw-r--r--gnu/usr.bin/man/man/man.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gnu/usr.bin/man/man/man.c b/gnu/usr.bin/man/man/man.c
index 3633e88..31ccd8c 100644
--- a/gnu/usr.bin/man/man/man.c
+++ b/gnu/usr.bin/man/man/man.c
@@ -89,6 +89,8 @@ static int print_where;
#ifdef __FreeBSD__
static char *locale, *locale_opts, *locale_nroff, *locale_codeset;
static char locale_terr[3], locale_lang[3];
+static char *man_locale;
+static int use_man_locale;
static int use_original;
struct ltable {
char *lcode;
@@ -443,6 +445,7 @@ man_getopt (argc, argv)
break;
}
}
+ asprintf(&man_locale, "%s.%s", locale_lang, locale_codeset);
}
} else {
if (locale == NULL) {
@@ -1030,8 +1033,10 @@ parse_roff_directive (cp, file, buf, bufsize)
#ifdef __FreeBSD__
char lbuf[FILENAME_MAX];
- snprintf(lbuf, sizeof(lbuf), "%s -T%s", NROFF,
- locale_opts == NULL ? "ascii" : locale_opts);
+ snprintf(lbuf, sizeof(lbuf), "%s -T%s%s%s", NROFF,
+ locale_opts == NULL ? "ascii" : locale_opts,
+ use_man_locale ? " -dlocale=" : "",
+ use_man_locale ? man_locale : "");
add_directive (&first, lbuf, file, buf, bufsize);
#else
add_directive (&first, NROFF " -Tascii", file, buf, bufsize);
@@ -1583,6 +1588,7 @@ man (name)
l_found = 0;
if (locale != NULL) {
locale_opts = locale_nroff;
+ use_man_locale = 1;
if (*locale_lang != '\0' && *locale_terr != '\0') {
snprintf(buf, sizeof(buf), "%s/%s_%s.%s", *mp,
locale_lang, locale_terr, locale_codeset);
@@ -1596,6 +1602,7 @@ man (name)
if (is_directory (buf) == 1)
l_found = try_section (buf, shortsec, longsec, name, glob);
}
+ use_man_locale = 0;
if (!l_found && strcmp(locale_lang, "en") != 0) {
snprintf(buf, sizeof(buf), "%s/en.%s", *mp,
locale_codeset);
@@ -1604,6 +1611,7 @@ man (name)
}
}
locale_opts = NULL;
+ use_man_locale = 0;
}
if (!l_found) {
#endif
@@ -1632,6 +1640,7 @@ man (name)
l_found = 0;
if (locale != NULL) {
locale_opts = locale_nroff;
+ use_man_locale = 1;
if (*locale_lang != '\0' && *locale_terr != '\0') {
snprintf(buf, sizeof(buf), "%s/%s_%s.%s", *mp,
locale_lang, locale_terr, locale_codeset);
@@ -1645,6 +1654,7 @@ man (name)
if (is_directory (buf) == 1)
l_found = try_section (buf, *sp, longsec, name, glob);
}
+ use_man_locale = 0;
if (!l_found && strcmp(locale_lang, "en") != 0) {
snprintf(buf, sizeof(buf), "%s/en.%s", *mp,
locale_codeset);
@@ -1653,6 +1663,7 @@ man (name)
}
}
locale_opts = NULL;
+ use_man_locale = 0;
}
if (!l_found) {
#endif
OpenPOWER on IntegriCloud