=================================================================== RCS file: /cvs/mandoc/read.c,v retrieving revision 1.150 retrieving revision 1.154 diff -u -p -r1.150 -r1.154 --- mandoc/read.c 2016/07/19 16:22:52 1.150 +++ mandoc/read.c 2016/12/07 22:59:29 1.154 @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.150 2016/07/19 16:22:52 schwarze Exp $ */ +/* $Id: read.c,v 1.154 2016/12/07 22:59:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2016 Ingo Schwarze @@ -19,10 +19,8 @@ #include "config.h" #include -#if HAVE_MMAP #include #include -#endif #include #include @@ -143,7 +141,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "empty argument, using 0n", "missing display type, using -ragged", "list type is not the first argument", - "missing -width in -tag list, using 8n", + "missing -width in -tag list, using 6n", "missing utility name, using \"\"", "missing function name, using \"\"", "empty head in list item", @@ -317,6 +315,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size 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 */ @@ -422,14 +421,21 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size } if ('"' == blk.buf[i + 1] || '#' == blk.buf[i + 1]) { + j = i; 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 + i-1 - j, NULL); + ++i; + ++lnn; + break; } /* Backout trailing whitespaces */ @@ -598,7 +604,6 @@ read_whole_file(struct mparse *curp, const char *file, size_t off; ssize_t ssz; -#if HAVE_MMAP struct stat st; if (fstat(fd, &st) == -1) @@ -622,7 +627,6 @@ read_whole_file(struct mparse *curp, const char *file, if (fb->buf != MAP_FAILED) return 1; } -#endif if (curp->gzip) { if ((gz = gzdopen(fd, "rb")) == NULL) @@ -747,11 +751,9 @@ mparse_readfd(struct mparse *curp, int fd, const char (MPARSE_UTF8 | MPARSE_LATIN1); mparse_parse_buffer(curp, blk, file); curp->filenc = save_filenc; -#if HAVE_MMAP if (with_mmap) munmap(blk.buf, blk.sz); else -#endif free(blk.buf); } return curp->file_status;