aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-17 22:43:14 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-17 22:43:14 +0000
commit332a2176094538e094fed8f1e5e251feb6b666e9 (patch)
treefc47a670fb157e5593d57abc86413feaabb2ca07 /roff.c
parentfc10222b160be65e60f5afcce864bcc8a49b6b48 (diff)
downloadmandoc-332a2176094538e094fed8f1e5e251feb6b666e9.tar.gz
mandoc-332a2176094538e094fed8f1e5e251feb6b666e9.tar.zst
mandoc-332a2176094538e094fed8f1e5e251feb6b666e9.zip
style message about missing RCS ids; inspired by mdoclint
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/roff.c b/roff.c
index 1577a9b8..ce481526 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.312 2017/06/14 22:51:25 schwarze Exp $ */
+/* $Id: roff.c,v 1.313 2017/06/17 22:43:14 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -1166,6 +1166,7 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
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 */
@@ -1183,6 +1184,23 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
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;