aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-17 23:07:00 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-17 23:07:00 +0000
commit1646ab1fa6b40399b2913086e23b635022a70349 (patch)
treeca4d97aa402f8ff1cc8c666301d74e396ba536ed
parent332a2176094538e094fed8f1e5e251feb6b666e9 (diff)
downloadmandoc-1646ab1fa6b40399b2913086e23b635022a70349.tar.gz
mandoc-1646ab1fa6b40399b2913086e23b635022a70349.tar.zst
mandoc-1646ab1fa6b40399b2913086e23b635022a70349.zip
style message about duplicate RCS ids; inspired by mdoclint
-rw-r--r--mandoc.17
-rw-r--r--mandoc.h3
-rw-r--r--read.c3
-rw-r--r--roff.c8
4 files changed, 16 insertions, 5 deletions
diff --git a/mandoc.1 b/mandoc.1
index 1db087fa..e5821b49 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.200 2017/06/17 22:43:14 schwarze Exp $
+.\" $Id: mandoc.1,v 1.201 2017/06/17 23:07:00 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -799,6 +799,11 @@ generated by CVS
or
.Ic NetBSD
keyword substitution as conventionally used in these operating systems.
+.It Sy "duplicate RCS id"
+A single manual page contains two copies of the RCS identifier for
+the same operating system.
+Consider deleting the later instance and moving the first one up
+to the top of the page.
.It Sy "useless macro"
.Pq mdoc
A
diff --git a/mandoc.h b/mandoc.h
index d0b48552..83623167 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.231 2017/06/17 22:43:14 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.232 2017/06/17 23:07:00 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -50,6 +50,7 @@ enum mandocerr {
MANDOCERR_MDOCDATE_MISSING, /* Mdocdate missing: Dd ... */
MANDOCERR_DATE_LEGACY, /* legacy man(7) date format: Dd ... */
MANDOCERR_RCS_MISSING, /* RCS id missing */
+ MANDOCERR_RCS_REP, /* duplicate RCS id: ... */
MANDOCERR_MACRO_USELESS, /* useless macro: macro */
MANDOCERR_BX, /* consider using OS macro: macro */
MANDOCERR_ER_ORDER, /* errnos out of order: Er ... */
diff --git a/read.c b/read.c
index 5e030f65..36a849dc 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.177 2017/06/17 22:43:14 schwarze Exp $ */
+/* $Id: read.c,v 1.178 2017/06/17 23:07:00 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -92,6 +92,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"Mdocdate missing",
"legacy man(7) date format",
"RCS id missing",
+ "duplicate RCS id",
"useless macro",
"consider using OS macro",
"errnos out of order",
diff --git a/roff.c b/roff.c
index ce481526..abb1ff5f 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.313 2017/06/17 22:43:14 schwarze Exp $ */
+/* $Id: roff.c,v 1.314 2017/06/17 23:07:00 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -1196,8 +1196,12 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
}
if (cp != NULL &&
isalnum((unsigned char)*cp) == 0 &&
- strchr(cp, '$') != NULL)
+ strchr(cp, '$') != NULL) {
+ if (r->man->meta.rcsids & (1 << os_e))
+ mandoc_msg(MANDOCERR_RCS_REP, r->parse,
+ ln, stesc + 1 - buf->buf, stesc + 1);
r->man->meta.rcsids |= 1 << os_e;
+ }
/* Handle trailing whitespace. */