summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-11-10 12:52:12 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-11-10 12:52:12 +0000
commit12a20fc23d9bf386966f3dcd1d43721030019b41 (patch)
tree5986ab10da3d5917d3d3e12b9aed927c49679db7
parentefaf812e24b84bbf5cc7e9c4a1467f801c951631 (diff)
downloadmandoc-12a20fc23d9bf386966f3dcd1d43721030019b41.tar.gz
merge rev. 1.153: warn about trailing whitespace at the end of comments
-rw-r--r--read.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/read.c b/read.c
index 5a7efd60..32d18634 100644
--- a/read.c
+++ b/read.c
@@ -425,11 +425,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 */