summaryrefslogtreecommitdiffstats
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
commit54aa3e7af1c3beec35737d65971e1ab156590b65 (patch)
tree79a51f249e110c03586551fe44c1530ecb184b04 /roff.c
parent21509c66569ab6d9d1e505b1130be978f17f1d7c (diff)
downloadmandoc-54aa3e7af1c3beec35737d65971e1ab156590b65.tar.gz
Even on macro lines, \} must not cause whitespace.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/roff.c b/roff.c
index 501d754c..e23fae1e 100644
--- a/roff.c
+++ b/roff.c
@@ -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);