aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit01c92e6ac259f38d13175f7f9d76233713fff535 (patch)
tree1fc1a664a9171de99efb910f3ae460232a01c8a9 /mdoc_man.c
parent3eba010f0f31a85978d61e0b11e8da1c4933dac5 (diff)
downloadmandoc-01c92e6ac259f38d13175f7f9d76233713fff535.tar.gz
mandoc-01c92e6ac259f38d13175f7f9d76233713fff535.tar.zst
mandoc-01c92e6ac259f38d13175f7f9d76233713fff535.zip
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.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index 8dcfae74..b6362f46 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.64 2014/07/02 03:48:07 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.65 2014/07/02 19:55:10 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -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);
}