-/* $OpenBSD: man_validate.c,v 1.100 2017/06/17 16:47:29 schwarze Exp $ */
+/* $OpenBSD: man_validate.c,v 1.101 2017/06/17 22:40:27 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
man->meta.date = man->quick ? mandoc_strdup("") :
mandoc_normdate(man, NULL, n->line, n->pos);
}
+
+ if (man->meta.os_e &&
+ (man->meta.rcsids & (1 << man->meta.os_e)) == 0)
+ mandoc_msg(MANDOCERR_RCS_MISSING, man->parse, 0, 0, NULL);
}
static void
man->meta.os = mandoc_strdup(n->string);
else if (man->defos != NULL)
man->meta.os = mandoc_strdup(man->defos);
+ man->meta.os_e = man->meta.os == NULL ? MDOC_OS_OTHER :
+ strstr(man->meta.os, "OpenBSD") != NULL ? MDOC_OS_OPENBSD :
+ strstr(man->meta.os, "NetBSD") != NULL ? MDOC_OS_NETBSD :
+ MDOC_OS_OTHER;
/* TITLE MSEC DATE OS ->VOL<- */
/* If missing, use the default VOL name for MSEC. */
-.\" $OpenBSD: mandoc.1,v 1.123 2017/06/13 15:05:22 schwarze Exp $
+.\" $OpenBSD: mandoc.1,v 1.124 2017/06/17 22:40:27 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 13 2017 $
+.Dd $Mdocdate: June 17 2017 $
.Dt MANDOC 1
.Os
.Sh NAME
.Xr uname 3
function.
.Bl -ohang
+.It Sy "Mdocdate found"
+.Pq mdoc , Nx
+The
+.Ic \&Dd
+macro uses CVS
+.Ic Mdocdate
+keyword substitution, which is not supported by the
+.Nx
+base system.
+Consider using the conventional
+.Dq "Month dd, yyyy"
+format instead.
+.It Sy "Mdocdate missing"
+.Pq mdoc , Ox
+The
+.Ic \&Dd
+macro does not use CVS
+.Ic Mdocdate
+keyword substitution, but using it is conventionally expected in the
+.Ox
+base system.
+.It Sy "legacy man(7) date format"
+.Pq mdoc
+The
+.Ic \&Dd
+macro uses the legacy
+.Xr man 7
+date format
+.Dq yyyy-dd-mm .
+Consider using the conventional
+.Xr mdoc 7
+date format
+.Dq "Month dd, yyyy"
+instead.
+.It Sy "RCS id missing"
+.Pq Ox , Nx
+The manual page lacks the comment line with the RCS identifier
+generated by CVS
+.Ic OpenBSD
+or
+.Ic NetBSD
+keyword substitution as conventionally used in these operating systems.
.It Sy "useless macro"
.Pq mdoc
A
-/* $OpenBSD: mandoc.h,v 1.172 2017/06/14 01:31:19 schwarze Exp $ */
+/* $OpenBSD: mandoc.h,v 1.173 2017/06/17 22:40:27 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
MANDOCERR_MDOCDATE, /* Mdocdate found: Dd ... */
MANDOCERR_MDOCDATE_MISSING, /* Mdocdate missing: Dd ... */
MANDOCERR_DATE_LEGACY, /* legacy man(7) date format: Dd ... */
+ MANDOCERR_RCS_MISSING, /* RCS id missing */
MANDOCERR_MACRO_USELESS, /* useless macro: macro */
MANDOCERR_BX, /* consider using OS macro: macro */
MANDOCERR_ER_ORDER, /* errnos out of order: Er ... */
-/* $OpenBSD: mdoc_validate.c,v 1.253 2017/06/11 20:02:48 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.254 2017/06/17 22:40:27 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
mandoc_msg(MANDOCERR_OS_MISSING,
mdoc->parse, 0, 0, NULL);
mdoc->meta.os = mandoc_strdup("");
- }
+ } else if (mdoc->meta.os_e &&
+ (mdoc->meta.rcsids & (1 << mdoc->meta.os_e)) == 0)
+ mandoc_msg(MANDOCERR_RCS_MISSING,
+ mdoc->parse, 0, 0, NULL);
/* Check that we begin with a proper `Sh'. */
-/* $OpenBSD: read.c,v 1.148 2017/06/11 19:36:31 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.149 2017/06/17 22:40:27 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
"Mdocdate found",
"Mdocdate missing",
"legacy man(7) date format",
+ "RCS id missing",
"useless macro",
"consider using OS macro",
"errnos out of order",
-/* $OpenBSD: roff.c,v 1.184 2017/06/14 22:50:37 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.185 2017/06/17 22:40:27 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
size_t maxl; /* expected length of the escape name */
size_t naml; /* actual length of the escape name */
enum mandoc_esc esc; /* type of the escape sequence */
+ enum mdoc_os os_e; /* kind of RCS id seen */
int inaml; /* length returned from mandoc_escape() */
int expand_count; /* to avoid infinite loops */
int npos; /* position in numeric expression */
stesc++;
if (*stesc != '"' && *stesc != '#')
continue;
+
+ /* Comment found, look for RCS id. */
+
+ if ((cp = strstr(stesc, "$" "OpenBSD")) != NULL) {
+ os_e = MDOC_OS_OPENBSD;
+ cp += 8;
+ } else if ((cp = strstr(stesc, "$" "NetBSD")) != NULL) {
+ os_e = MDOC_OS_NETBSD;
+ cp += 7;
+ }
+ if (cp != NULL &&
+ isalnum((unsigned char)*cp) == 0 &&
+ strchr(cp, '$') != NULL)
+ r->man->meta.rcsids |= 1 << os_e;
+
+ /* Handle trailing whitespace. */
+
cp = strchr(stesc--, '\0') - 1;
if (*cp == '\n') {
done = 1;
-/* $OpenBSD: roff.h,v 1.36 2017/06/14 22:50:37 schwarze Exp $ */
+/* $OpenBSD: roff.h,v 1.37 2017/06/17 22:40:27 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
char *name; /* Leading manual name. */
char *date; /* Normalized date. */
int hasbody; /* Document is not empty. */
+ int rcsids; /* Bits indexed by enum mdoc_os. */
enum mdoc_os os_e; /* Operating system. */
};