From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1098 invoked from network); 31 May 2022 18:10:30 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 31 May 2022 18:10:30 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id fc58795e for ; Tue, 31 May 2022 13:10:28 -0500 (EST) Received: from localhost (mandoc.bsd.lv [local]) by mandoc.bsd.lv (OpenSMTPD) with ESMTPA id ef95fee4 for ; Tue, 31 May 2022 13:10:28 -0500 (EST) Date: Tue, 31 May 2022 13:10:28 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Trivial patch to put the roff(7) \g (interpolate format of X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: <336596d87b415673@mandoc.bsd.lv> Log Message: ----------- 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". Modified Files: -------------- mandoc: roff.c roff_escape.c roff.7 Revision Data ------------- Index: roff.7 =================================================================== RCS file: /home/cvs/mandoc/mandoc/roff.7,v retrieving revision 1.118 retrieving revision 1.119 diff -Lroff.7 -Lroff.7 -u -p -r1.118 -r1.119 --- roff.7 +++ roff.7 @@ -2085,7 +2085,8 @@ defaults to .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 Index: roff_escape.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/roff_escape.c,v retrieving revision 1.3 retrieving revision 1.4 diff -Lroff_escape.c -Lroff_escape.c -u -p -r1.3 -r1.4 --- roff_escape.c +++ roff_escape.c @@ -158,6 +158,7 @@ roff_escape(const char *buf, const int l case '$': case '*': case 'V': + case 'g': case 'n': rval = ESCAPE_EXPAND; break; @@ -165,7 +166,6 @@ roff_escape(const char *buf, const int l case 'M': case 'O': case 'Y': - case 'g': case 'k': case 'm': rval = ESCAPE_IGNORE; Index: roff.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/roff.c,v retrieving revision 1.389 retrieving revision 1.390 diff -Lroff.c -Lroff.c -u -p -r1.389 -r1.390 --- roff.c +++ roff.c @@ -1535,6 +1535,8 @@ roff_expand(struct roff *r, struct buf * 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", -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv