diff options
author | 2015-02-01 23:10:15 +0000 | |
---|---|---|
committer | 2015-02-01 23:10:15 +0000 | |
commit | 03ed6ec9385fcd95bb8af5d6753c2358cdf25533 (patch) | |
tree | d1a0b6bd50e426f2a1d084459e604b49f1587ef2 /usr.bin/mandoc/mdoc_man.c | |
parent | free(NULL) works, so stop checking for non-zero length allocation (diff) | |
download | wireguard-openbsd-03ed6ec9385fcd95bb8af5d6753c2358cdf25533.tar.xz wireguard-openbsd-03ed6ec9385fcd95bb8af5d6753c2358cdf25533.zip |
fix .Eo/.Ec spacing
Diffstat (limited to 'usr.bin/mandoc/mdoc_man.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_man.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index 869df056843..e399e466ca3 100644 --- a/usr.bin/mandoc/mdoc_man.c +++ b/usr.bin/mandoc/mdoc_man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_man.c,v 1.81 2015/01/28 17:30:37 schwarze Exp $ */ +/* $OpenBSD: mdoc_man.c,v 1.82 2015/02/01 23:10:15 schwarze Exp $ */ /* * Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org> * @@ -1132,16 +1132,38 @@ static int pre_eo(DECL_ARGS) { - outflags &= ~(MMAN_spc | MMAN_nl); + if (n->end == ENDBODY_NOT && + n->parent->head->child == NULL && + n->child != NULL && + n->child->end != ENDBODY_NOT) + print_word("\\&"); + else if (n->end != ENDBODY_NOT ? n->child != NULL : + n->parent->head->child != NULL && + (n->parent->body->child != NULL || + n->parent->tail->child != NULL)) + outflags &= ~(MMAN_spc | MMAN_nl); return(1); } static void post_eo(DECL_ARGS) { + int body, tail; + + if (n->end != ENDBODY_NOT) { + outflags |= MMAN_spc; + return; + } - if (n->end != ENDBODY_SPACE) + body = n->child != NULL || n->parent->head->child != NULL; + tail = n->parent->tail != NULL && n->parent->tail->child != NULL; + + if (body && tail) outflags &= ~MMAN_spc; + else if ( ! (body || tail)) + print_word("\\&"); + else if ( ! tail) + outflags |= MMAN_spc; } static int |