summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-12-07 22:59:29 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-12-07 22:59:29 +0000
commite3f5b4421b6d2e53c29f596fe31bbca8f1b4ca0c (patch)
tree485f741b8fa045cee308105ffc2b1d4e6349a5a8
parent803378b72f19597cd04b3c66cba39bca8a75f5d1 (diff)
downloadmandoc-e3f5b4421b6d2e53c29f596fe31bbca8f1b4ca0c.tar.gz
When reporting "whitespace at end of input line" on lines ending with
roff(7) comments, let the column number in the message point to the end of the line rather than to the beginning of the comment. Improvement suggested by bluhm@.
-rw-r--r--read.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/read.c b/read.c
index d7a10803..851e9153 100644
--- a/read.c
+++ b/read.c
@@ -315,6 +315,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
const char *save_file;
char *cp;
size_t pos; /* byte number in the ln buffer */
+ size_t j; /* auxiliary byte number in the blk buffer */
enum rofferr rr;
int of;
int lnn; /* line number in the real file */
@@ -420,6 +421,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
}
if ('"' == blk.buf[i + 1] || '#' == blk.buf[i + 1]) {
+ j = i;
i += 2;
/* Comment, skip to end of line */
for (; i < blk.sz; ++i) {
@@ -430,7 +432,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
mandoc_msg(
MANDOCERR_SPACE_EOL,
curp, curp->line,
- pos, NULL);
+ pos + i-1 - j, NULL);
++i;
++lnn;
break;