-/* $OpenBSD: libmandoc.h,v 1.39 2014/12/28 14:39:08 schwarze Exp $ */
+/* $OpenBSD: libmandoc.h,v 1.40 2015/01/14 22:57:57 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
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 {
-/* $OpenBSD: mandoc.h,v 1.121 2015/01/14 22:02:00 schwarze Exp $ */
+/* $OpenBSD: mandoc.h,v 1.122 2015/01/14 22:57:57 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
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 */
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
-/* $OpenBSD: read.c,v 1.83 2015/01/14 22:02:00 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.84 2015/01/14 22:57:57 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
"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",
"generic fatal error",
"input too large",
- "NOT IMPLEMENTED: .so with absolute path or \"..\"",
".so request failed",
};
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')) {
-/* $OpenBSD: roff.c,v 1.120 2015/01/07 12:19:17 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.121 2015/01/14 22:57:57 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
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);
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;