summaryrefslogtreecommitdiffstats
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
commit27a44c9e5c3585e621cce681418cec8e4d676158 (patch)
tree40a1f4f53ac0b6fdf25dbae1aa7251b90ce66468
parent470431727a7ba5fde764e27df2eb620a81285593 (diff)
downloadmandoc-27a44c9e5c3585e621cce681418cec8e4d676158.tar.gz
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--roff.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/roff.c b/roff.c
index ad8c6eeb..1370a58b 100644
--- a/roff.c
+++ b/roff.c
@@ -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);
}