From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Traditional roff(7) explicitly allows certain control characters
Date: Thu, 22 Jan 2015 16:38:46 -0500 (EST) [thread overview]
Message-ID: <14397682004368833826.enqueue@fantadrom.bsd.lv> (raw)
Log Message:
-----------
Traditional roff(7) explicitly allows certain control characters
in the input stream (SOH, STX, ETX, ENQ, ACK, BEL, BS) for specific
purposes (leaders, backspace, delimiters, .tr), but making sure
these don't leak through to the output is tricky, so mark them as
unsupported for now.
Modified Files:
--------------
mdocml:
mandoc.h
read.c
Revision Data
-------------
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v
retrieving revision 1.184
retrieving revision 1.185
diff -Lmandoc.h -Lmandoc.h -u -p -r1.184 -r1.185
--- mandoc.h
+++ 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 */
Index: read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/read.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -Lread.c -Lread.c -u -p -r1.113 -r1.114
--- read.c
+++ read.c
@@ -215,6 +215,7 @@ static const char * const mandocerrs[MAN
"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
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
*/
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
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++] = '?';
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2015-01-22 21:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14397682004368833826.enqueue@fantadrom.bsd.lv \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).