diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2020-10-24 22:52:35 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2020-10-24 22:52:35 +0000 |
commit | bedad44e7b0c542a949440ca1dd5a52e29f7ea55 (patch) | |
tree | 050e82001d89bab5c4d1de7c81fe0f414b4231d1 /usr.bin/mandoc | |
parent | 7955b5d18c86a65cdfd2483d99bf9376dede7d94 (diff) |
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 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/mandoc.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c index 0b2d301dba7..265393d8a18 100644 --- a/usr.bin/mandoc/mandoc.c +++ b/usr.bin/mandoc/mandoc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.c,v 1.85 2020/01/19 16:16:32 schwarze Exp $ */ +/* $OpenBSD: mandoc.c,v 1.86 2020/10/24 22:52:34 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> @@ -201,7 +201,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') @@ -236,13 +247,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 @@ -457,6 +461,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; } |