* mdocml: downgrade ".so with absolute path" from FATAL to ERROR; allows
@ 2015-01-14 22:58 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-01-14 22:58 UTC (permalink / raw)
To: source
Log Message:
-----------
downgrade ".so with absolute path" from FATAL to ERROR;
allows to get rid of ROFF_ERR
Modified Files:
--------------
mdocml:
libmandoc.h
mandoc.h
read.c
roff.c
Revision Data
-------------
Index: libmandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/libmandoc.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -Llibmandoc.h -Llibmandoc.h -u -p -r1.53 -r1.54
--- libmandoc.h
+++ libmandoc.h
@@ -24,8 +24,7 @@ enum rofferr {
ROFF_SO, /* include another file */
ROFF_IGN, /* ignore current line */
ROFF_TBL, /* a table row was successfully parsed */
- ROFF_EQN, /* an equation was successfully parsed */
- ROFF_ERR /* badness: puke and stop */
+ ROFF_EQN /* an equation was successfully parsed */
};
struct buf {
Index: read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/read.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -Lread.c -Lread.c -u -p -r1.108 -r1.109
--- read.c
+++ read.c
@@ -210,6 +210,7 @@ static const char * const mandocerrs[MAN
"uname(3) system call failed, using UNKNOWN",
"unknown standard specifier",
"skipping request without numeric argument",
+ "NOT IMPLEMENTED: .so with absolute path or \"..\"",
"skipping all arguments",
"skipping excess arguments",
"divide by zero",
@@ -217,7 +218,6 @@ static const char * const mandocerrs[MAN
"generic fatal error",
"input too large",
- "NOT IMPLEMENTED: .so with absolute path or \"..\"",
".so request failed",
};
@@ -504,9 +504,6 @@ rerun:
case ROFF_IGN:
pos = 0;
continue;
- case ROFF_ERR:
- assert(MANDOCLEVEL_FATAL <= curp->file_status);
- break;
case ROFF_SO:
if ( ! (curp->options & MPARSE_SO) &&
(i >= blk.sz || blk.buf[i] == '\0')) {
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v
retrieving revision 1.179
retrieving revision 1.180
diff -Lmandoc.h -Lmandoc.h -u -p -r1.179 -r1.180
--- mandoc.h
+++ mandoc.h
@@ -166,6 +166,7 @@ enum mandocerr {
MANDOCERR_OS_UNAME, /* uname(3) system call failed, using UNKNOWN */
MANDOCERR_ST_BAD, /* unknown standard specifier: St standard */
MANDOCERR_IT_NONUM, /* skipping request without numeric argument */
+ MANDOCERR_SO_PATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */
MANDOCERR_ARG_SKIP, /* skipping all arguments: macro args */
MANDOCERR_ARG_EXCESS, /* skipping excess arguments: macro ... args */
MANDOCERR_DIVZERO, /* divide by zero */
@@ -173,7 +174,6 @@ enum mandocerr {
MANDOCERR_FATAL, /* ===== start of fatal errors ===== */
MANDOCERR_TOOLARGE, /* input too large */
- MANDOCERR_SO_PATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */
MANDOCERR_SO_FAIL, /* .so request failed */
MANDOCERR_MAX
Index: roff.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.c,v
retrieving revision 1.248
retrieving revision 1.249
diff -Lroff.c -Lroff.c -u -p -r1.248 -r1.249
--- roff.c
+++ roff.c
@@ -2103,7 +2103,7 @@ roff_tr(ROFF_ARGS)
static enum rofferr
roff_so(ROFF_ARGS)
{
- char *name;
+ char *name, *cp;
name = buf->buf + pos;
mandoc_vmsg(MANDOCERR_SO, r->parse, ln, ppos, "so %s", name);
@@ -2118,7 +2118,12 @@ roff_so(ROFF_ARGS)
if (*name == '/' || strstr(name, "../") || strstr(name, "/..")) {
mandoc_vmsg(MANDOCERR_SO_PATH, r->parse, ln, ppos,
".so %s", name);
- return(ROFF_ERR);
+ buf->sz = mandoc_asprintf(&cp,
+ ".sp\nSee the file %s.\n.sp", name) + 1;
+ free(buf->buf);
+ buf->buf = cp;
+ *offs = 0;
+ return(ROFF_REPARSE);
}
*offs = pos;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-01-14 22:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-14 22:58 mdocml: downgrade ".so with absolute path" from FATAL to ERROR; allows schwarze
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).