summaryrefslogtreecommitdiffstats
path: root/mdoc_macro.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-02-06 01:07:22 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-02-06 01:07:22 +0000
commitc99b323342e53370e16b09aca5d39e301af04142 (patch)
tree407fe105f5432bb2ed36ce1b6351ec93de2229c9 /mdoc_macro.c
parent902f6a979cb9238ddee3e60feebb858f2c773e7f (diff)
downloadmandoc-c99b323342e53370e16b09aca5d39e301af04142.tar.gz
better handle .In .Sh .Ss .St .Xr without arguments
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r--mdoc_macro.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 78a8e5e6..dc710030 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -904,6 +904,12 @@ blk_full(MACRO_PROT_ARGS)
nl = MDOC_NEWLINE & mdoc->flags;
+ if (buf[*pos] == '\0' && (tok == MDOC_Sh || tok == MDOC_Ss)) {
+ mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
+ line, ppos, mdoc_macronames[tok]);
+ return;
+ }
+
if ( ! (mdoc_macros[tok].flags & MDOC_EXPLICIT)) {
/* Here, tok is one of Sh Ss Nm Nd It. */
@@ -1367,6 +1373,11 @@ in_line_argn(MACRO_PROT_ARGS)
}
if (j == 0) {
+ if (tok == MDOC_In || tok == MDOC_St || tok == MDOC_Xr) {
+ mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
+ line, ppos, mdoc_macronames[tok]);
+ return;
+ }
mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
if (ac == ARGS_PUNCT && tok == MDOC_Pf)
append_delims(mdoc, line, pos, buf);