version 1.168, 2017/06/01 15:25:39 |
version 1.172, 2017/06/07 23:29:48 |
Line 90 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 90 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
|
|
"useless macro", |
"useless macro", |
"consider using OS macro", |
"consider using OS macro", |
|
"errnos out of order", |
|
"duplicate errno", |
"description line ends with a full stop", |
"description line ends with a full stop", |
|
|
"generic warning", |
"generic warning", |
Line 139 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 141 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
"fill mode already enabled, skipping", |
"fill mode already enabled, skipping", |
"fill mode already disabled, skipping", |
"fill mode already disabled, skipping", |
"line scope broken", |
"line scope broken", |
|
"skipping blank line in line scope", |
|
|
/* related to missing macro arguments */ |
/* related to missing macro arguments */ |
"skipping empty request", |
"skipping empty request", |
Line 226 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 229 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
"NOT IMPLEMENTED: Bd -file", |
"NOT IMPLEMENTED: Bd -file", |
"skipping display without arguments", |
"skipping display without arguments", |
"missing list type, using -item", |
"missing list type, using -item", |
|
"argument is not numeric, using 1", |
"missing manual name, using \"\"", |
"missing manual name, using \"\"", |
"uname(3) system call failed, using UNKNOWN", |
"uname(3) system call failed, using UNKNOWN", |
"unknown standard specifier", |
"unknown standard specifier", |
Line 325 mparse_buf_r(struct mparse *curp, struct buf blk, size |
|
Line 329 mparse_buf_r(struct mparse *curp, struct buf blk, size |
|
const char *save_file; |
const char *save_file; |
char *cp; |
char *cp; |
size_t pos; /* byte number in the ln buffer */ |
size_t pos; /* byte number in the ln buffer */ |
size_t j; /* auxiliary byte number in the blk buffer */ |
|
enum rofferr rr; |
enum rofferr rr; |
int of; |
int of; |
int lnn; /* line number in the real file */ |
int lnn; /* line number in the real file */ |
Line 407 mparse_buf_r(struct mparse *curp, struct buf blk, size |
|
Line 410 mparse_buf_r(struct mparse *curp, struct buf blk, size |
|
continue; |
continue; |
} |
} |
|
|
/* Trailing backslash = a plain char. */ |
|
|
|
if (blk.buf[i] != '\\' || i + 1 == blk.sz) { |
|
ln.buf[pos++] = blk.buf[i++]; |
|
continue; |
|
} |
|
|
|
/* |
|
* Found escape and at least one other character. |
|
* When it's a newline character, skip it. |
|
* When there is a carriage return in between, |
|
* skip that one as well. |
|
*/ |
|
|
|
if ('\r' == blk.buf[i + 1] && i + 2 < blk.sz && |
|
'\n' == blk.buf[i + 2]) |
|
++i; |
|
if ('\n' == blk.buf[i + 1]) { |
|
i += 2; |
|
++lnn; |
|
continue; |
|
} |
|
|
|
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 (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 */ |
|
for (; pos > 0; --pos) { |
|
if (ln.buf[pos - 1] != ' ') |
|
break; |
|
if (pos > 2 && ln.buf[pos - 2] == '\\') |
|
break; |
|
} |
|
break; |
|
} |
|
|
|
/* Catch escaped bogus characters. */ |
|
|
|
c = (unsigned char) blk.buf[i+1]; |
|
|
|
if ( ! (isascii(c) && |
|
(isgraph(c) || isblank(c)))) { |
|
mandoc_vmsg(MANDOCERR_CHAR_BAD, curp, |
|
curp->line, pos, "0x%x", c); |
|
i += 2; |
|
ln.buf[pos++] = '?'; |
|
continue; |
|
} |
|
|
|
/* Some other escape sequence, copy & cont. */ |
|
|
|
ln.buf[pos++] = blk.buf[i++]; |
ln.buf[pos++] = blk.buf[i++]; |
ln.buf[pos++] = blk.buf[i++]; |
|
} |
} |
|
|
if (pos >= ln.sz) |
if (pos + 1 >= ln.sz) |
resize_buf(&ln, 256); |
resize_buf(&ln, 256); |
|
|
|
if (i == blk.sz || blk.buf[i] == '\0') |
|
ln.buf[pos++] = '\n'; |
ln.buf[pos] = '\0'; |
ln.buf[pos] = '\0'; |
|
|
/* |
/* |