source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Treat \*[.T] in the same way as \*(.T rather than calling
Date: Sat, 24 Oct 2020 17:58:12 -0500 (EST)	[thread overview]
Message-ID: <7ef67260df2b0062@mandoc.bsd.lv> (raw)

Log Message:
-----------
Treat \*[.T] in the same way as \*(.T rather than calling abort(3).
Bug found because the groff-current manual pages started using the
variant form of this predefined string.

Modified Files:
--------------
    mandoc:
        mandoc.c
    mandoc/regress/roff/nr:
        predef.in
        predef.out_ascii
    mandoc/regress/roff/string:
        dotT.in
        dotT.out_ascii
        dotT.out_html
        dotT.out_markdown
        dotT.out_utf8

Revision Data
-------------
Index: predef.in
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/roff/nr/predef.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/roff/nr/predef.in -Lregress/roff/nr/predef.in -u -p -r1.2 -r1.3
--- regress/roff/nr/predef.in
+++ regress/roff/nr/predef.in
@@ -1,4 +1,4 @@
-.\" $OpenBSD: predef.in,v 1.3 2017/07/04 14:53:27 schwarze Exp $
+.\" $OpenBSD: predef.in,v 1.4 2020/10/24 22:52:34 schwarze Exp $
 .TH NR-PREDEF 1 "August 29, 2015"
 .SH NAME
 nr-predef \- pre-defined read-only integer number registers
@@ -18,7 +18,7 @@ ascii mode: \n(.A
 groff mode: \n(.g
 horizontal resolution: \n(.H
 adjustment mode: \n(.j
-output device defined: \n(.T
+output device defined: \n(.T \n[.T]
 vertical resolution: \n(.V
 .mym
 .mym one
Index: predef.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/roff/nr/predef.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/roff/nr/predef.out_ascii -Lregress/roff/nr/predef.out_ascii -u -p -r1.1 -r1.2
--- regress/roff/nr/predef.out_ascii
+++ regress/roff/nr/predef.out_ascii
@@ -10,7 +10,7 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
        groff mode: 1
        horizontal resolution: 24
        adjustment mode: 0
-       output device defined: 1
+       output device defined: 1 1
        vertical resolution: 40
        user defined macro with 0 arguments:
        user defined macro with 1 arguments: one
Index: mandoc.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -Lmandoc.c -Lmandoc.c -u -p -r1.117 -r1.118
--- mandoc.c
+++ mandoc.c
@@ -203,7 +203,18 @@ mandoc_escape(const char **end, const ch
 	case 'O':
 	case 'V':
 	case 'Y':
-		gly = (*start)[-1] == 'f' ? ESCAPE_FONT : ESCAPE_IGNORE;
+	case '*':
+		switch ((*start)[-1]) {
+		case 'f':
+			gly = ESCAPE_FONT;
+			break;
+		case '*':
+			gly = ESCAPE_DEVICE;
+			break;
+		default:
+			gly = ESCAPE_IGNORE;
+			break;
+		}
 		switch (**start) {
 		case '(':
 			if ((*start)[-1] == 'O')
@@ -238,13 +249,6 @@ mandoc_escape(const char **end, const ch
 			break;
 		}
 		break;
-	case '*':
-		if (strncmp(*start, "(.T", 3) != 0)
-			abort();
-		gly = ESCAPE_DEVICE;
-		*start = ++*end;
-		*sz = 2;
-		break;
 
 	/*
 	 * These escapes are of the form \X'Y', where 'X' is the trigger
@@ -458,6 +462,9 @@ mandoc_escape(const char **end, const ch
 		if ((int)strspn(*start + 1, "0123456789ABCDEFabcdef")
 		    + 1 == *sz)
 			gly = ESCAPE_UNICODE;
+		break;
+	case ESCAPE_DEVICE:
+		assert(*sz == 2 && (*start)[0] == '.' && (*start)[1] == 'T');
 		break;
 	default:
 		break;
Index: dotT.out_utf8
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/roff/string/dotT.out_utf8,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/roff/string/dotT.out_utf8 -Lregress/roff/string/dotT.out_utf8 -u -p -r1.2 -r1.3
--- regress/roff/string/dotT.out_utf8
+++ regress/roff/string/dotT.out_utf8
@@ -6,10 +6,10 @@ N\bNA\bAM\bME\bE
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
      BEGINTEST
 
-     We are using the utf8 device.
+     We are using the utf8 device.  It can also be written as the utf8 device.
 
-     The device name can be overridden.
+     The device name can be overridden.  Both escape forms work for the name.
      ENDTEST
      end of file
 
-OpenBSD                         January 7, 2019                        OpenBSD
+OpenBSD                        October 24, 2020                        OpenBSD
Index: dotT.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/roff/string/dotT.out_ascii,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/roff/string/dotT.out_ascii -Lregress/roff/string/dotT.out_ascii -u -p -r1.2 -r1.3
--- regress/roff/string/dotT.out_ascii
+++ regress/roff/string/dotT.out_ascii
@@ -6,10 +6,11 @@ N\bNA\bAM\bME\bE
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
      BEGINTEST
 
-     We are using the ascii device.
+     We are using the ascii device.  It can also be written as the ascii
+     device.
 
-     The device name can be overridden.
+     The device name can be overridden.  Both escape forms work for the name.
      ENDTEST
      end of file
 
-OpenBSD                         January 7, 2019                        OpenBSD
+OpenBSD                        October 24, 2020                        OpenBSD
Index: dotT.out_html
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/roff/string/dotT.out_html,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lregress/roff/string/dotT.out_html -Lregress/roff/string/dotT.out_html -u -p -r1.4 -r1.5
--- regress/roff/string/dotT.out_html
+++ regress/roff/string/dotT.out_html
@@ -1,2 +1,4 @@
-<p class="Pp">We are using the html device.</p>
-<p class="Pp">The device name can be overridden.</p>
+<p class="Pp">We are using the html device. It can also be written as the html
+    device.</p>
+<p class="Pp">The device name can be overridden. Both escape forms work for the
+    name.</p>
Index: dotT.out_markdown
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/roff/string/dotT.out_markdown,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/roff/string/dotT.out_markdown -Lregress/roff/string/dotT.out_markdown -u -p -r1.2 -r1.3
--- regress/roff/string/dotT.out_markdown
+++ regress/roff/string/dotT.out_markdown
@@ -9,9 +9,11 @@ STRING-DOTT(1) - General Commands Manual
 BEGINTEST
 
 We are using the  markdown device.
+It can also be written as the  markdown device.
 
 The device name can be overridden.
+Both escape forms work for the name.
 ENDTEST  
 end of file
 
-OpenBSD - January 7, 2019
+OpenBSD - October 24, 2020
Index: dotT.in
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/roff/string/dotT.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/roff/string/dotT.in -Lregress/roff/string/dotT.in -u -p -r1.2 -r1.3
--- regress/roff/string/dotT.in
+++ regress/roff/string/dotT.in
@@ -1,4 +1,4 @@
-.\" $OpenBSD: dotT.in,v 1.2 2019/01/07 06:51:37 schwarze Exp $
+.\" $OpenBSD: dotT.in,v 1.3 2020/10/24 22:52:34 schwarze Exp $
 .Dd $Mdocdate$
 .Dt STRING-DOTT 1
 .Os
@@ -9,9 +9,11 @@
 BEGINTEST
 .Pp
 We are using the \*(.T device.
+It can also be written as the \*[.T] device.
 .Pp
 .ds .T name
 The device \*(.T can be overridden.
+Both escape forms work for the \*[.T].
 .nf
 ENDTEST
 .br
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


                 reply	other threads:[~2020-10-24 22:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ef67260df2b0062@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).