summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-02-17 17:55:12 +0000
committerschwarze <schwarze@openbsd.org>2015-02-17 17:55:12 +0000
commitc527ae4232df9c2086338eac4890e89e758a2614 (patch)
tree794e2de172726cb35ab6acb6f9e9f1b48daf0110
parentLet .it accept numerical expressions, not just numerical constants. (diff)
downloadwireguard-openbsd-c527ae4232df9c2086338eac4890e89e758a2614.tar.xz
wireguard-openbsd-c527ae4232df9c2086338eac4890e89e758a2614.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.
-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);
}