From a28ef4e886aa07659cbef3b85534540414c09092 Mon Sep 17 00:00:00 2001 From: schwarze Date: Sat, 14 Aug 2021 13:51:46 +0000 Subject: [PATCH] print a BAGARG message if -T markdown is requested on man(7) input; suggested by Michael Stapelberg at debian dot org --- usr.bin/mandoc/main.c | 5 ++++- usr.bin/mandoc/mandoc.1 | 12 ++++++++++-- usr.bin/mandoc/mandoc.h | 3 ++- usr.bin/mandoc/mandoc_msg.c | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index d309d969a41..f16be3caf6e 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.257 2021/06/02 18:27:36 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.258 2021/08/14 13:51:46 schwarze Exp $ */ /* * Copyright (c) 2010-2012, 2014-2021 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons @@ -944,6 +944,9 @@ parse(struct mparse *mp, int fd, const char *file, case OUTT_PS: terminal_man(outst->outdata, meta); break; + case OUTT_MARKDOWN: + mandoc_msg(MANDOCERR_MAN_TMARKDOWN, 0, 0, NULL); + break; default: break; } diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index 6df390cce3c..1e8dcc4b251 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mandoc.1,v 1.178 2021/07/04 15:38:08 schwarze Exp $ +.\" $OpenBSD: mandoc.1,v 1.179 2021/08/14 13:51:46 schwarze Exp $ .\" .\" Copyright (c) 2012, 2014-2021 Ingo Schwarze .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 4 2021 $ +.Dd $Mdocdate: August 14 2021 $ .Dt MANDOC 1 .Os .Sh NAME @@ -2371,6 +2371,14 @@ The .Fl O Cm tag option was specified but the tag was not found in any of the displayed manual pages. +.It Sy "\-Tmarkdown unsupported for man(7) input" +.Pq man +The +.Fl T Cm markdown +option was specified but an input file uses the +.Xr man 7 +language. +No output is produced for that input file. .El .Sh SEE ALSO .Xr apropos 1 , diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 98cf7867485..c23d2285421 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.h,v 1.215 2021/08/10 12:36:42 schwarze Exp $ */ +/* $OpenBSD: mandoc.h,v 1.216 2021/08/14 13:51:46 schwarze Exp $ */ /* * Copyright (c) 2012-2021 Ingo Schwarze * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons @@ -257,6 +257,7 @@ enum mandocerr { MANDOCERR_BADVAL_BAD, /* bad argument value */ MANDOCERR_BADVAL_DUPE, /* duplicate argument value */ MANDOCERR_TAG, /* no such tag */ + MANDOCERR_MAN_TMARKDOWN, /* -Tmarkdown unsupported for man(7) input */ MANDOCERR_SYSERR, /* ===== start of system errors ===== */ diff --git a/usr.bin/mandoc/mandoc_msg.c b/usr.bin/mandoc/mandoc_msg.c index 26306dad7e9..a3897c65247 100644 --- a/usr.bin/mandoc/mandoc_msg.c +++ b/usr.bin/mandoc/mandoc_msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc_msg.c,v 1.13 2021/07/04 15:38:09 schwarze Exp $ */ +/* $OpenBSD: mandoc_msg.c,v 1.14 2021/08/14 13:51:46 schwarze Exp $ */ /* * Copyright (c) 2014-2021 Ingo Schwarze * Copyright (c) 2010, 2011 Kristaps Dzonsons @@ -255,6 +255,7 @@ static const char *const type_message[MANDOCERR_MAX] = { "bad option value", "duplicate option value", "no such tag", + "-Tmarkdown unsupported for man(7) input", /* system errors */ NULL, -- 2.20.1