summaryrefslogtreecommitdiffstats
path: root/mdoc_man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2012-11-19 02:08:33 +0000
committerIngo Schwarze <schwarze@openbsd.org>2012-11-19 02:08:33 +0000
commit8bcb19ad96666e4a14040ca305268fb59995fd25 (patch)
tree486b74a4f9b1e766d123185fa8c1ca50301ff48b /mdoc_man.c
parentc9b2badc3fad9570abf31abebb3eadc4b3852605 (diff)
downloadmandoc-8bcb19ad96666e4a14040ca305268fb59995fd25.tar.gz
Three portability improvements by millert@:
* Use "\\ " not "\\~" as the non-breaking space as historic nroff doesn't support the latter. * The '-' before the flags needs to be quoted to prevent nroff from putting a line break between the '-' and the flag character. * Disable hyphenation and, for nroff, disable justification which is consistent with how mdoc behaves (and produces more readable manuals). (OpenBSD rev. 1.39, 1.40 and 1.41)
Diffstat (limited to 'mdoc_man.c')
-rw-r--r--mdoc_man.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index d16efb14..11d958b9 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -334,11 +334,9 @@ print_word(const char *s)
*/
if (MMAN_spc_force & outflags || '\0' == s[0] ||
NULL == strchr(".,:;)]?!", s[0]) || '\0' != s[1]) {
- if (MMAN_Bk & outflags) {
+ if (MMAN_Bk & outflags)
putchar('\\');
- putchar('~');
- } else
- putchar(' ');
+ putchar(' ');
if (TPremain)
TPremain--;
}
@@ -358,7 +356,7 @@ print_word(const char *s)
for ( ; *s; s++) {
switch (*s) {
case (ASCII_NBRSP):
- printf("\\~");
+ printf("\\ ");
break;
case (ASCII_HYPH):
putchar('-');
@@ -535,10 +533,13 @@ man_mdoc(void *arg, const struct mdoc *mdoc)
meta = mdoc_meta(mdoc);
n = mdoc_node(mdoc);
- printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",
+ printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n",
meta->title, meta->msec, meta->date,
meta->os, meta->vol);
+ /* Disable hyphenation and if nroff, disable justification. */
+ printf(".nh\n.if n .ad l");
+
outflags = MMAN_nl | MMAN_Sm;
if (0 == fontqueue.size) {
fontqueue.size = 8;
@@ -1053,7 +1054,7 @@ pre_fl(DECL_ARGS)
{
font_push('B');
- print_word("-");
+ print_word("\\-");
outflags &= ~MMAN_spc;
return(1);
}
@@ -1531,7 +1532,7 @@ pre_ux(DECL_ARGS)
if (NULL == n->child)
return(0);
outflags &= ~MMAN_spc;
- print_word("\\~");
+ print_word("\\ ");
outflags &= ~MMAN_spc;
return(1);
}