summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-11-10 12:47:50 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-11-10 12:47:50 +0000
commit4c8c262182c29683c323acb1c11680220b2921e3 (patch)
tree9605cb6f88a648695af3367c0ae0419d2c13a3c6
parent916e8b3c6cf54040508ef6a735c1135ac5b717e7 (diff)
downloadmandoc-4c8c262182c29683c323acb1c11680220b2921e3.tar.gz
warn about trailing whitespace at the end of comments;
missing feature noticed by jmc@
-rw-r--r--read.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/read.c b/read.c
index 311ec53b..d7a10803 100644
--- a/read.c
+++ b/read.c
@@ -423,11 +423,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 */