summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/roff.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-08-16 13:49:40 +0000
committerschwarze <schwarze@openbsd.org>2018-08-16 13:49:40 +0000
commit8138dde89f220e9b56e60d4274fe6546e3c891d7 (patch)
tree2ce4d8fa86989dd80dc09f412121181295e07168 /usr.bin/mandoc/roff.c
parentRemove unused variable. (diff)
downloadwireguard-openbsd-8138dde89f220e9b56e60d4274fe6546e3c891d7.tar.xz
wireguard-openbsd-8138dde89f220e9b56e60d4274fe6546e3c891d7.zip
Implement the \*(.T predefined string (interpolate device name)
by allowing the preprocessor to pass it through to the formatters. Used for example by the groff_char(7) manual page.
Diffstat (limited to 'usr.bin/mandoc/roff.c')
-rw-r--r--usr.bin/mandoc/roff.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 71b595abb0f..6c6261ea80f 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.202 2018/08/10 04:41:21 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.203 2018/08/16 13:49:40 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -1365,6 +1365,19 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
if (arg_complete) {
deftype = ROFFDEF_USER | ROFFDEF_PRE;
res = roff_getstrn(r, stnam, naml, &deftype);
+
+ /*
+ * If not overriden, let \*(.T
+ * through to the formatters.
+ */
+
+ if (res == NULL && naml == 2 &&
+ stnam[0] == '.' && stnam[1] == 'T') {
+ roff_setstrn(&r->strtab,
+ ".T", 2, NULL, 0, 0);
+ stesc--;
+ continue;
+ }
}
break;
case 'B':