aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-10-24 22:57:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-10-24 22:57:39 +0000
commitdc7248813739f10e087a87325e7aca75a5630c16 (patch)
treefdeddd350e8bd619fb51020263551f3e79b32964
parent7f36e58ef077e2bf3ff4592144b6be7ccc0db8de (diff)
downloadmandoc-dc7248813739f10e087a87325e7aca75a5630c16.tar.gz
mandoc-dc7248813739f10e087a87325e7aca75a5630c16.tar.zst
mandoc-dc7248813739f10e087a87325e7aca75a5630c16.zip
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.
-rw-r--r--mandoc.c25
-rw-r--r--regress/roff/nr/predef.in4
-rw-r--r--regress/roff/nr/predef.out_ascii2
-rw-r--r--regress/roff/string/dotT.in6
-rw-r--r--regress/roff/string/dotT.out_ascii7
-rw-r--r--regress/roff/string/dotT.out_html6
-rw-r--r--regress/roff/string/dotT.out_markdown4
-rw-r--r--regress/roff/string/dotT.out_utf86
8 files changed, 37 insertions, 23 deletions
diff --git a/mandoc.c b/mandoc.c
index aad9a272..302f4fa1 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -1,4 +1,4 @@
-/* $Id: mandoc.c,v 1.117 2020/01/19 16:44:50 schwarze Exp $ */
+/* $Id: mandoc.c,v 1.118 2020/10/24 22:57:39 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
@@ -203,7 +203,18 @@ mandoc_escape(const char **end, const char **start, int *sz)
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 char **start, int *sz)
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
@@ -459,6 +463,9 @@ mandoc_escape(const char **end, const char **start, int *sz)
+ 1 == *sz)
gly = ESCAPE_UNICODE;
break;
+ case ESCAPE_DEVICE:
+ assert(*sz == 2 && (*start)[0] == '.' && (*start)[1] == 'T');
+ break;
default:
break;
}
diff --git a/regress/roff/nr/predef.in b/regress/roff/nr/predef.in
index 480a052e..72d78f09 100644
--- a/regress/roff/nr/predef.in
+++ b/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
diff --git a/regress/roff/nr/predef.out_ascii b/regress/roff/nr/predef.out_ascii
index 6973d296..8634ce33 100644
--- a/regress/roff/nr/predef.out_ascii
+++ b/regress/roff/nr/predef.out_ascii
@@ -10,7 +10,7 @@ DDEESSCCRRIIPPTTIIOONN
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
diff --git a/regress/roff/string/dotT.in b/regress/roff/string/dotT.in
index 62b4a959..feef0ab9 100644
--- a/regress/roff/string/dotT.in
+++ b/regress/roff/string/dotT.in
@@ -1,5 +1,5 @@
-.\" $OpenBSD: dotT.in,v 1.2 2019/01/07 06:51:37 schwarze Exp $
-.Dd $Mdocdate: January 7 2019 $
+.\" $OpenBSD: dotT.in,v 1.3 2020/10/24 22:52:34 schwarze Exp $
+.Dd $Mdocdate: October 24 2020 $
.Dt STRING-DOTT 1
.Os
.Sh NAME
@@ -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
diff --git a/regress/roff/string/dotT.out_ascii b/regress/roff/string/dotT.out_ascii
index 26f53380..28304304 100644
--- a/regress/roff/string/dotT.out_ascii
+++ b/regress/roff/string/dotT.out_ascii
@@ -6,10 +6,11 @@ NNAAMMEE
DDEESSCCRRIIPPTTIIOONN
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
diff --git a/regress/roff/string/dotT.out_html b/regress/roff/string/dotT.out_html
index 51ab1411..a44d9cef 100644
--- a/regress/roff/string/dotT.out_html
+++ b/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>
diff --git a/regress/roff/string/dotT.out_markdown b/regress/roff/string/dotT.out_markdown
index d7400eaa..9ec52b1a 100644
--- a/regress/roff/string/dotT.out_markdown
+++ b/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
diff --git a/regress/roff/string/dotT.out_utf8 b/regress/roff/string/dotT.out_utf8
index 63bbf5fd..2c89f416 100644
--- a/regress/roff/string/dotT.out_utf8
+++ b/regress/roff/string/dotT.out_utf8
@@ -6,10 +6,10 @@ NNAAMMEE
DDEESSCCRRIIPPTTIIOONN
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