summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2022-05-31 18:09:57 +0000
committerIngo Schwarze <schwarze@openbsd.org>2022-05-31 18:09:57 +0000
commitafaba3e78072edb0c5149a491c9709b57f31745a (patch)
tree2d95461d1de32c4183c1ae03e7231f8a1b7af40d /roff.c
parentd677d96107effef249eb44f9d28860fe7a0fe029 (diff)
downloadmandoc-afaba3e78072edb0c5149a491c9709b57f31745a.tar.gz
Trivial patch to put the roff(7) \g (interpolate format of register)
escape sequence into the correct parsing class, ESCAPE_EXPAND. Expansion of \g is supposed to work exactly like the expansion of the related escape sequence \n (interpolate register value), but since we ignore the .af (assign output format) request, we just interpolate an empty string to replace the \g sequence. Surprising as it may seem, this actually makes a formatting difference for deviate input like ".O\gNx" which used to raise bogus "escaped character not allowed in a name" and "skipping unknown macro" errors and printed nothing, whereas now it correctly prints "OpenBSD".
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/roff.c b/roff.c
index e89ca000..119be89f 100644
--- a/roff.c
+++ b/roff.c
@@ -1535,6 +1535,8 @@ roff_expand(struct roff *r, struct buf *buf, int ln, int pos, char ec)
roff_expand_patch(buf, iendarg, "}", iend);
roff_expand_patch(buf, iesc, "${", iarg);
continue;
+ case 'g':
+ break;
case 'n':
if (iendarg > iarg)
(void)snprintf(ubuf, sizeof(ubuf), "%d",