From 2f84042e7587b8319a33ea55f63ee51e94afcc06 Mon Sep 17 00:00:00 2001 From: schwarze Date: Sat, 24 Jun 2017 15:59:28 +0000 Subject: [PATCH] in the base system, suggest leaving .Os blank; inspired by mdoclint --- usr.bin/mandoc/mandoc.1 | 8 +++++++- usr.bin/mandoc/mandoc.h | 3 ++- usr.bin/mandoc/mdoc_validate.c | 9 ++++++++- usr.bin/mandoc/read.c | 3 ++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index c53c138120e..c41e4317ebd 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mandoc.1,v 1.126 2017/06/24 14:38:27 schwarze Exp $ +.\" $OpenBSD: mandoc.1,v 1.127 2017/06/24 15:59:28 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons .\" Copyright (c) 2012, 2014-2017 Ingo Schwarze @@ -816,6 +816,12 @@ macro does not use CVS keyword substitution, but using it is conventionally expected in the .Ox base system. +.It Sy "operating system explicitly specified" +.Pq mdoc , Ox , Nx +The +.Ic \&Os +macro has an argument. +In the base system, it is conventionally left blank. .It Sy "RCS id missing" .Pq Ox , Nx The manual page lacks the comment line with the RCS identifier diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index f7359091d37..cb6ffead8c3 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.h,v 1.175 2017/06/24 14:38:27 schwarze Exp $ */ +/* $OpenBSD: mandoc.h,v 1.176 2017/06/24 15:59:28 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -48,6 +48,7 @@ enum mandocerr { MANDOCERR_MDOCDATE, /* Mdocdate found: Dd ... */ MANDOCERR_MDOCDATE_MISSING, /* Mdocdate missing: Dd ... */ + MANDOCERR_OS_ARG, /* operating system explicitly specified: Os ... */ MANDOCERR_RCS_MISSING, /* RCS id missing */ MANDOCERR_STYLE, /* ===== start of style suggestions ===== */ diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index a4ef3b532ac..212af6c23f4 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_validate.c,v 1.255 2017/06/24 14:38:27 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.256 2017/06/24 15:59:28 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -2569,6 +2569,13 @@ out: * the operating system earlier. */ + if (n->child != NULL) + mandoc_vmsg(MANDOCERR_OS_ARG, mdoc->parse, + n->child->line, n->child->pos, + "Os %s (%s)", n->child->string, + mdoc->meta.os_e == MANDOC_OS_OPENBSD ? + "OpenBSD" : "NetBSD"); + while (n->tok != MDOC_Dd) if ((n = n->prev) == NULL) return; diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 16fabd13a36..40826ec152f 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.151 2017/06/24 14:38:28 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.152 2017/06/24 15:59:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -86,6 +86,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "Mdocdate found", "Mdocdate missing", + "operating system explicitly specified", "RCS id missing", "generic style suggestion", -- 2.20.1