summaryrefslogtreecommitdiffstats
path: root/mdoc_man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-02 19:55:10 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-02 19:55:10 +0000
commitfdc95e0f088e210664eb7459003c922102fc748e (patch)
tree2941a73b51965c3192f9e63b7579762c3e8c0ad5 /mdoc_man.c
parente98d951b402f5f61bf0fafc86ae5ad5a03f1c85e (diff)
downloadmandoc-fdc95e0f088e210664eb7459003c922102fc748e.tar.gz
When .Sm is called without an argument, groff toggles the spacing mode,
so let us do the same for compatibility. Using this feature is of course not recommended except in manual page obfuscation contests.
Diffstat (limited to 'mdoc_man.c')
-rw-r--r--mdoc_man.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index 8e81a1fb..59de74ab 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1565,11 +1565,16 @@ static int
pre_sm(DECL_ARGS)
{
- assert(n->child && MDOC_TEXT == n->child->type);
- if (0 == strcmp("on", n->child->string))
- outflags |= MMAN_Sm | MMAN_spc;
+ if (NULL == n->child)
+ outflags ^= MMAN_Sm;
+ else if (0 == strcmp("on", n->child->string))
+ outflags |= MMAN_Sm;
else
outflags &= ~MMAN_Sm;
+
+ if (MMAN_Sm & outflags)
+ outflags |= MMAN_spc;
+
return(0);
}