summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mandoc.h3
-rw-r--r--read.c14
2 files changed, 10 insertions, 7 deletions
diff --git a/mandoc.h b/mandoc.h
index 18b496a4..61aa5428 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -145,7 +145,7 @@ enum mandocerr {
/* related to document structure and macros */
MANDOCERR_FILE, /* cannot open file */
MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */
- MANDOCERR_BADCHAR, /* skipping bad character: number */
+ MANDOCERR_CHAR_BAD, /* skipping bad character: number */
MANDOCERR_MACRO, /* skipping unknown macro: macro */
MANDOCERR_REQ_INSEC, /* skipping insecure request: request */
MANDOCERR_IT_STRAY, /* skipping item outside list: It ... */
@@ -172,6 +172,7 @@ enum mandocerr {
MANDOCERR_UNSUPP, /* ===== start of unsupported features ===== */
MANDOCERR_TOOLARGE, /* input too large */
+ MANDOCERR_CHAR_UNSUPP, /* unsupported control character: number */
MANDOCERR_REQ_UNSUPP, /* unsupported roff request: request */
MANDOCERR_TBL, /* unsupported table syntax */
MANDOCERR_TBLOPT, /* unsupported table option */
diff --git a/read.c b/read.c
index 07e6ce50..c0b390a6 100644
--- a/read.c
+++ b/read.c
@@ -215,6 +215,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"unsupported feature",
"input too large",
+ "unsupported control character",
"unsupported roff request",
"unsupported table syntax",
"unsupported table option",
@@ -369,9 +370,8 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
if (c & 0x80) {
if ( ! (curp->filenc && preconv_encode(
&blk, &i, &ln, &pos, &curp->filenc))) {
- mandoc_vmsg(MANDOCERR_BADCHAR,
- curp, curp->line, pos,
- "0x%x", c);
+ mandoc_vmsg(MANDOCERR_CHAR_BAD, curp,
+ curp->line, pos, "0x%x", c);
ln.buf[pos++] = '?';
i++;
}
@@ -383,8 +383,10 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
*/
if (c == 0x7f || (c < 0x20 && c != 0x09)) {
- mandoc_vmsg(MANDOCERR_BADCHAR, curp,
- curp->line, pos, "0x%x", c);
+ mandoc_vmsg(c == 0x00 || c == 0x04 ||
+ c > 0x0a ? MANDOCERR_CHAR_BAD :
+ MANDOCERR_CHAR_UNSUPP,
+ curp, curp->line, pos, "0x%x", c);
i++;
ln.buf[pos++] = '?';
continue;
@@ -440,7 +442,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
if ( ! (isascii(c) &&
(isgraph(c) || isblank(c)))) {
- mandoc_vmsg(MANDOCERR_BADCHAR, curp,
+ mandoc_vmsg(MANDOCERR_CHAR_BAD, curp,
curp->line, pos, "0x%x", c);
i += 2;
ln.buf[pos++] = '?';