aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-03-07 18:30:11 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-03-07 18:30:11 +0000
commit3bfe2f390a614764a145e5cb543f22f7c4864417 (patch)
tree48ce1a09de0827d11183987efb34dfba56f4a38a /roff.c
parentc67334742a26b9ae675f65c29adcf7af60659ca4 (diff)
downloadmandoc-3bfe2f390a614764a145e5cb543f22f7c4864417.tar.gz
mandoc-3bfe2f390a614764a145e5cb543f22f7c4864417.tar.zst
mandoc-3bfe2f390a614764a145e5cb543f22f7c4864417.zip
Even on macro lines, \} must not cause whitespace.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/roff.c b/roff.c
index 0772d8ab..9cf39dbf 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.195 2014/03/07 02:22:05 schwarze Exp $ */
+/* $Id: roff.c,v 1.196 2014/03/07 18:30:11 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1070,25 +1070,21 @@ roff_cond_sub(ROFF_ARGS)
ln, ppos, pos, offs));
}
+ /*
+ * If `\}' occurs on a macro line without a preceding macro,
+ * drop the line completely.
+ */
+
+ ep = *bufp + pos;
+ if ('\\' == ep[0] && '}' == ep[1])
+ rr = ROFFRULE_DENY;
+
/* Always check for the closing delimiter `\}'. */
- ep = &(*bufp)[pos];
while (NULL != (ep = strchr(ep, '\\'))) {
if ('}' != *(++ep))
continue;
-
- /*
- * If we're at the end of line, then just chop
- * off the \} and resize the buffer.
- * If we aren't, then convert it to spaces.
- */
-
- if ('\0' == *(ep + 1)) {
- *--ep = '\0';
- *szp -= 2;
- } else
- *(ep - 1) = *ep = ' ';
-
+ *ep = '&';
roff_ccond(r, ln, pos);
}
return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT);