summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/roff.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-08-18 21:36:53 +0000
committerschwarze <schwarze@openbsd.org>2018-08-18 21:36:53 +0000
commit2c723d0874c54630707bc6bc3baf2946a48b0612 (patch)
treeed3611c0b1dbe263b0273b39df44072fad891845 /usr.bin/mandoc/roff.c
parentparagraphs can contain .MT and .UR blocks (diff)
downloadwireguard-openbsd-2c723d0874c54630707bc6bc3baf2946a48b0612.tar.xz
wireguard-openbsd-2c723d0874c54630707bc6bc3baf2946a48b0612.zip
support the highly surprising escape sequence \# (line continuation
with comment); used for example by gropdf(1)
Diffstat (limited to 'usr.bin/mandoc/roff.c')
-rw-r--r--usr.bin/mandoc/roff.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 364c6b1cb79..1e8b65eaef6 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.205 2018/08/18 02:03:41 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.206 2018/08/18 21:36:53 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -1203,7 +1203,14 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
r->man->next = ROFF_NEXT_SIBLING;
}
- /* Discard comments. */
+ /* Line continuation with comment. */
+
+ if (stesc[1] == '#') {
+ *stesc = '\0';
+ return ROFF_APPEND;
+ }
+
+ /* Discard normal comments. */
while (stesc > start && stesc[-1] == ' ')
stesc--;