]> git.cameronkatri.com Git - mandoc.git/blobdiff - read.c
When reporting "whitespace at end of input line" on lines ending with
[mandoc.git] / read.c
diff --git a/read.c b/read.c
index 39ff23373ee0ac3a46dba57ed63ce4e2e60cf13f..1bb0f046bbd1f78ccbb97e0bf939b9ce12e4a331 100644 (file)
--- 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;