diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-06-17 23:06:44 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-06-17 23:06:44 +0000 |
commit | 193ae02590c3c164fe13c9c4200686ddc2e4099a (patch) | |
tree | 12e33647b3bb9a5f385fa25ef627882af9fb3b16 /usr.bin/mandoc | |
parent | 53d95672f9c6c884dbe5b952ad938fe8a38b73d5 (diff) |
style message about duplicate RCS ids; inspired by mdoclint
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/mandoc.1 | 7 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.h | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/read.c | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/roff.c | 8 |
4 files changed, 16 insertions, 5 deletions
diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index 0e6d6b322cc..6210f1c91a5 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mandoc.1,v 1.124 2017/06/17 22:40:27 schwarze Exp $ +.\" $OpenBSD: mandoc.1,v 1.125 2017/06/17 23:06:43 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/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index bb7b9c32ebd..55e1643dec4 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.h,v 1.173 2017/06/17 22:40:27 schwarze Exp $ */ +/* $OpenBSD: mandoc.h,v 1.174 2017/06/17 23:06:43 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/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 83422873abc..3994caca0d3 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.149 2017/06/17 22:40:27 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.150 2017/06/17 23:06:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -88,6 +88,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/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index 516c13217d1..c108ae89d02 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: roff.c,v 1.185 2017/06/17 22:40:27 schwarze Exp $ */ +/* $OpenBSD: roff.c,v 1.186 2017/06/17 23:06:43 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -1194,8 +1194,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. */ |