aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/read.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-11-10 12:47:50 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-11-10 12:47:50 +0000
commit66286e275f33f71863b63d2ba531fa83643e4a42 (patch)
tree3d47724a84edffce0d7bd36f1361cd74d73400e5 /read.c
parent4e5a7b892d320d6e0b296cb74ccafb4f7ed79729 (diff)
downloadmandoc-66286e275f33f71863b63d2ba531fa83643e4a42.tar.gz
mandoc-66286e275f33f71863b63d2ba531fa83643e4a42.tar.zst
mandoc-66286e275f33f71863b63d2ba531fa83643e4a42.zip
warn about trailing whitespace at the end of comments;
missing feature noticed by jmc@
Diffstat (limited to 'read.c')
-rw-r--r--read.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/read.c b/read.c
index 8ab1ad16..39ff2337 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.152 2016/10/09 18:16:56 schwarze Exp $ */
+/* $Id: read.c,v 1.153 2016/11/10 12:47:50 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 */