diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2016-11-10 12:52:12 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2016-11-10 12:52:12 +0000 |
commit | 12a20fc23d9bf386966f3dcd1d43721030019b41 (patch) | |
tree | 5986ab10da3d5917d3d3e12b9aed927c49679db7 /read.c | |
parent | efaf812e24b84bbf5cc7e9c4a1467f801c951631 (diff) | |
download | mandoc-12a20fc23d9bf386966f3dcd1d43721030019b41.tar.gz |
merge rev. 1.153: warn about trailing whitespace at the end of comments
Diffstat (limited to 'read.c')
-rw-r--r-- | read.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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 */ |