From 88c033be2011760f46e5a92f8388585b1e8904ea Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Tue, 13 Feb 2001 16:15:04 +0000 Subject: [PATCH] Make it possible for any given locale to use different groff(1) devices for localized and non-localized pages. Currently, for *.ISO_8859-1 locales the device in both cases is "latin1", and for KOI8-R locale it is "koi8-r" for localized and "ascii" for non-localized pages. Discussed with: des --- gnu/usr.bin/man/man/man.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/gnu/usr.bin/man/man/man.c b/gnu/usr.bin/man/man/man.c index 250cae4f309a..dd83afc43ff5 100644 --- a/gnu/usr.bin/man/man/man.c +++ b/gnu/usr.bin/man/man/man.c @@ -93,16 +93,17 @@ static char *alt_system_name; #ifdef __FreeBSD__ /* short_locale without country suffix */ static char *locale, *short_locale; -static char *locale_nroff = " -Tascii"; +static char *roff_dev = "ascii", *roff_ldev = "ascii"; static int use_original; struct ltable { char *lcode; - char *nroff; + char *ldev; /* roff device for localized manpages. */ + char *odev; /* roff device for original manpages. */ }; static struct ltable ltable[] = { - {"KOI8-R", " -Tkoi8-r"}, - {"ISO_8859-1", " -Tlatin1"}, - {NULL, NULL} + {"KOI8-R", "koi8-r", "ascii"}, + {"ISO_8859-1", "latin1", "latin1"}, + {NULL} }; #endif @@ -481,7 +482,8 @@ man_getopt (argc, argv) tmp = short_locale + 3; for (pltable = ltable; pltable->lcode != NULL; pltable++) { if (strcmp(pltable->lcode, tmp) == 0) { - locale_nroff = pltable->nroff; + roff_ldev = pltable->ldev; + roff_dev = pltable->odev; break; } } @@ -947,7 +949,7 @@ parse_roff_directive (cp, file, buf, bufsize) #ifdef __FreeBSD__ char lbuf[FILENAME_MAX]; - snprintf(lbuf, sizeof(lbuf), "%s%s", NEQN, locale_nroff); + snprintf(lbuf, sizeof(lbuf), "%s -T%s", NEQN, roff_dev); add_directive (&first, lbuf, file, buf, bufsize); #else add_directive (&first, NEQN, file, buf, bufsize); @@ -1025,7 +1027,7 @@ parse_roff_directive (cp, file, buf, bufsize) #ifdef __FreeBSD__ char lbuf[FILENAME_MAX]; - snprintf(lbuf, sizeof(lbuf), "%s%s", NROFF, locale_nroff); + snprintf(lbuf, sizeof(lbuf), "%s -T%s", NROFF, roff_dev); add_directive (&first, lbuf, file, buf, bufsize); #else add_directive (&first, NROFF " -Tascii", file, buf, bufsize); @@ -1571,6 +1573,7 @@ man (name) #ifdef __FreeBSD__ int l_found; char buf[FILENAME_MAX]; + char *roff_odev; #endif found = 0; @@ -1588,6 +1591,8 @@ man (name) #ifdef __FreeBSD__ l_found = 0; if (locale != NULL) { + roff_odev = roff_dev; + roff_dev = roff_ldev; snprintf(buf, sizeof(buf), "%s/%s", *mp, locale); if (is_directory (buf)) l_found = try_section (buf, section, name, glob); @@ -1596,6 +1601,7 @@ man (name) if (is_directory (buf)) l_found = try_section (buf, section, name, glob); } + roff_dev = roff_odev; } if (!l_found) { #endif @@ -1623,6 +1629,8 @@ man (name) #ifdef __FreeBSD__ l_found = 0; if (locale != NULL) { + roff_odev = roff_dev; + roff_dev = roff_ldev; snprintf(buf, sizeof(buf), "%s/%s", *mp, locale); if (is_directory (buf)) l_found = try_section (buf, *sp, name, glob); @@ -1631,6 +1639,7 @@ man (name) if (is_directory (buf)) l_found = try_section (buf, *sp, name, glob); } + roff_dev = roff_odev; } if (!l_found) { #endif