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".
-.\" $OpenBSD: roff.7,v 1.99 2022/05/30 22:50:40 schwarze Exp $
+.\" $OpenBSD: roff.7,v 1.100 2022/05/31 18:08:02 schwarze Exp $
.\"
.\" Copyright (c) 2010-2019, 2022 Ingo Schwarze <schwarze@openbsd.org>
.\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 30 2022 $
+.Dd $Mdocdate: May 31 2022 $
.Dt ROFF 7
.Os
.Sh NAME
.Ic \efP .
.It Ic \eg[ Ns Ar name Ns Ic \&]
Interpolate the format of a number register; ignored by
-.Xr mandoc 1 .
+.Xr mandoc 1 ,
+which interpolates an empty string instead.
For short names, there are variants
.Ic \eg Ns Ar c
and
-/* $OpenBSD: roff.c,v 1.261 2022/05/30 22:50:40 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.262 2022/05/31 18:08:02 schwarze Exp $ */
/*
* Copyright (c) 2010-2015, 2017-2022 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
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",
-/* $OpenBSD: roff_escape.c,v 1.3 2022/05/30 22:50:40 schwarze Exp $ */
+/* $OpenBSD: roff_escape.c,v 1.4 2022/05/31 18:08:02 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2020, 2022
* Ingo Schwarze <schwarze@openbsd.org>
case '$':
case '*':
case 'V':
+ case 'g':
case 'n':
rval = ESCAPE_EXPAND;
break;
case 'M':
case 'O':
case 'Y':
- case 'g':
case 'k':
case 'm':
rval = ESCAPE_IGNORE;