summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-17 17:55:13 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-17 17:55:13 +0000
commitfecdd17f55cd4e3aea32f1a96490dc875662c661 (patch)
treec70f01ef834e86992efc2ac1bc101c7f597eda29 /usr.bin
parente678cef2819f27c089cb8b2c9bbfe319f6a1e8cc (diff)
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 'usr.bin')
-rw-r--r--usr.bin/mandoc/roff.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 5c6a12aeb3e..7f294e2ed4b 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.133 2015/02/17 17:16:12 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.134 2015/02/17 17:55:12 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -2335,10 +2335,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);
}