summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2012-11-18 19:34:13 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2012-11-18 19:34:13 +0000
commite3a9dee00134adf12df61525713c9ba2d8e2a2ab (patch)
tree74bb212dd3f6ede5bcf987317098edff265b33d0 /usr.bin/mandoc
parentde450a1421bdaad17f76747ed06fb78e3467dfa2 (diff)
Make the generated man(7) code more portable by using .PD
instead of .sp -1v, which for example Solaris nroff handles poorly. Problem report and patch by millert@, with the print_word chunk tweaked by me.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/mdoc_man.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index a35f353e6a4..9e1acd7d528 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.43 2012/11/18 17:59:03 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.44 2012/11/18 19:34:12 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -249,6 +249,7 @@ static int outflags;
#define MMAN_Bk (1 << 7) /* word keep mode */
#define MMAN_An_split (1 << 8) /* author mode is "split" */
#define MMAN_An_nosplit (1 << 9) /* author mode is "nosplit" */
+#define MMAN_PD (1 << 10) /* inter-paragraph spacing disabled */
#define BL_STACK_MAX 32
@@ -300,8 +301,15 @@ print_word(const char *s)
* If we need a newline, print it now and start afresh.
*/
if (MMAN_PP & outflags) {
- if ( ! (MMAN_sp & outflags))
- printf("\n.sp -1v");
+ if (MMAN_sp & outflags) {
+ if (MMAN_PD & outflags) {
+ printf("\n.PD");
+ outflags &= ~MMAN_PD;
+ }
+ } else if ( ! (MMAN_PD & outflags)) {
+ printf("\n.PD 0");
+ outflags |= MMAN_PD;
+ }
printf("\n.PP\n");
} else if (MMAN_sp & outflags)
printf("\n.sp\n");
@@ -373,10 +381,16 @@ print_block(const char *s, int newflags)
{
outflags &= ~MMAN_PP;
- if (MMAN_sp & outflags)
+ if (MMAN_sp & outflags) {
outflags &= ~(MMAN_sp | MMAN_br);
- else
- print_line(".sp -1v", 0);
+ if (MMAN_PD & outflags) {
+ print_line(".PD", 0);
+ outflags &= ~MMAN_PD;
+ }
+ } else if (! (MMAN_PD & outflags)) {
+ print_line(".PD 0", 0);
+ outflags |= MMAN_PD;
+ }
outflags |= MMAN_nl;
print_word(s);
outflags |= newflags;