summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2016-11-10 12:47:05 +0000
committerschwarze <schwarze@openbsd.org>2016-11-10 12:47:05 +0000
commit5edec6bf3bdd63e1d1da21db55cbfc233df68e48 (patch)
tree97c5890d439e1b9deb12bcf98f9cc39df1ced76a
parentDon't forget to set the descriptor ready flag after decapsulation (diff)
downloadwireguard-openbsd-5edec6bf3bdd63e1d1da21db55cbfc233df68e48.tar.xz
wireguard-openbsd-5edec6bf3bdd63e1d1da21db55cbfc233df68e48.zip
warn about trailing whitespace at the end of comments;
missing feature noticed by jmc@
-rw-r--r--usr.bin/mandoc/read.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index 63d7b20a9ad..bbea60bc211 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read.c,v 1.125 2016/10/09 18:16:46 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.126 2016/11/10 12:47:05 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -418,11 +418,17 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
i += 2;
/* Comment, skip to end of line */
for (; i < blk.sz; ++i) {
- if ('\n' == blk.buf[i]) {
- ++i;
- ++lnn;
- break;
- }
+ if (blk.buf[i] != '\n')
+ continue;
+ if (blk.buf[i - 1] == ' ' ||
+ blk.buf[i - 1] == '\t')
+ mandoc_msg(
+ MANDOCERR_SPACE_EOL,
+ curp, curp->line,
+ pos, NULL);
+ ++i;
+ ++lnn;
+ break;
}
/* Backout trailing whitespaces */