aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/man
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2002-09-30 11:00:04 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2002-09-30 11:00:04 +0000
commitb660485bd46fc6ee2e9f075f0a9b472796d786c0 (patch)
tree3660e230c8fb2ff2e9194344b5cc986b49aa2c8c /gnu/usr.bin/man
parente00e16ad7f86c2c0112fc4172be2a1d03308f4c8 (diff)
downloadsrc-b660485bd46fc6ee2e9f075f0a9b472796d786c0.tar.gz
src-b660485bd46fc6ee2e9f075f0a9b472796d786c0.zip
Pass our idea of a manpage's locale from man(1) down to mdoc(7).
Notes
Notes: svn path=/head/; revision=104203
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 3633e8836d86..31ccd8c1d7b6 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