aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-02-17 18:09:14 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-02-17 18:09:14 +0000
commit790d9ca6372f759099b268a7c3256cba6f7db3a1 (patch)
tree3c92be756acf086ce6d584af8748870196e490d2 /roff.c
parent104c829123990f31b11953103544d94926d8efd0 (diff)
downloadmandoc-790d9ca6372f759099b268a7c3256cba6f7db3a1.tar.gz
mandoc-790d9ca6372f759099b268a7c3256cba6f7db3a1.tar.zst
mandoc-790d9ca6372f759099b268a7c3256cba6f7db3a1.zip
Cope with another one of the many kinds of DocBook stupidity:
Instead of just using .br, DocBook sometimes fiddles with the utterly unportable internal register \n[an-break-flag] that is only available in the GNU implementation of man(7) and then arms an input line trap to call the equally unportable internal macro .an-trap that, in the GNU implementation, inspects that variable; all the world is GNU, isn't it? Since naddy@ reports that quite a few ports manuals suffer from this insanity, let's just translate it to the intended .br. Et ceterum censeo DocBookem esse delendam.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/roff.c b/roff.c
index bb1581fc..01fb2966 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.261 2015/02/17 17:16:52 schwarze Exp $ */
+/* $Id: roff.c,v 1.262 2015/02/17 18:09:14 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -2337,10 +2337,19 @@ roff_it(ROFF_ARGS)
return(ROFF_IGN);
}
- /* Arm the input line trap. */
+ while (isspace((unsigned char)buf->buf[pos]))
+ pos++;
+
+ /*
+ * Arm the input line trap.
+ * Special-casing "an-trap" is an ugly workaround to cope
+ * with DocBook stupidly fiddling with man(7) internals.
+ */
roffit_lines = iv;
- roffit_macro = mandoc_strdup(buf->buf + pos);
+ roffit_macro = mandoc_strdup(iv != 1 ||
+ strcmp(buf->buf + pos, "an-trap") ?
+ buf->buf + pos : "br");
return(ROFF_IGN);
}