diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2016-11-10 12:47:50 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2016-11-10 12:47:50 +0000 |
commit | 4c8c262182c29683c323acb1c11680220b2921e3 (patch) | |
tree | 9605cb6f88a648695af3367c0ae0419d2c13a3c6 | |
parent | 916e8b3c6cf54040508ef6a735c1135ac5b717e7 (diff) | |
download | mandoc-4c8c262182c29683c323acb1c11680220b2921e3.tar.gz |
warn about trailing whitespace at the end of comments;
missing feature noticed by jmc@
-rw-r--r-- | read.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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 */ |