source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Treat \*[.T] in the same way as \*(.T rather than calling
@ 2020-10-24 22:58 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2020-10-24 22:58 UTC (permalink / raw)
  To: source

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-24 22:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-24 22:58 mandoc: Treat \*[.T] in the same way as \*(.T rather than calling schwarze

source@mandoc.bsd.lv

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/mandoc-source

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 mandoc-source mandoc-source/ http://inbox.vuxu.org/mandoc-source \
		source@mandoc.bsd.lv
	public-inbox-index mandoc-source

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git