aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/read.c
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
commit296ca97e61f5c92e7b681de5cfbefd00df41afe0 (patch)
treec00a54af6d2136181a8fca72d540b36ea4a3d8b2 /read.c
parentb0f4d52ef05e276a63213d952725f0aca8b4592e (diff)
downloadmandoc-296ca97e61f5c92e7b681de5cfbefd00df41afe0.tar.gz
mandoc-296ca97e61f5c92e7b681de5cfbefd00df41afe0.tar.zst
mandoc-296ca97e61f5c92e7b681de5cfbefd00df41afe0.zip
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@.
Diffstat (limited to 'read.c')
-rw-r--r--read.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/read.c b/read.c
index 39ff2337..1bb0f046 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.153 2016/11/10 12:47:50 schwarze Exp $ */
+/* $Id: read.c,v 1.154 2016/12/07 22:59:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;