summaryrefslogtreecommitdiffstats
path: root/mandoc.c
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
commitd795180ba82e3803716976abe8f023462d0c1576 (patch)
tree5f7bd6f6c1d284cc466a64943b41ee38e77d33c5 /mandoc.c
parente6ebe29e01dda236ae873eb8841f10bc6640c8d5 (diff)
downloadmandoc-d795180ba82e3803716976abe8f023462d0c1576.tar.gz
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.
Diffstat (limited to 'mandoc.c')
-rw-r--r--mandoc.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/mandoc.c b/mandoc.c
index c0fb2c3d..dfd1b466 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -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;
}