diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2012-05-27 17:48:57 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2012-05-27 17:48:57 +0000 |
commit | cc286dde362eb32238e74c6bd62962a7ffe6e872 (patch) | |
tree | 97852d737c2a1eefdd93d854c28cb4b9aa0236eb /read.c | |
parent | 7c536cb6230f46a3b6438c2611168d45f1ef2cb2 (diff) | |
download | mandoc-cc286dde362eb32238e74c6bd62962a7ffe6e872.tar.gz |
Support -Ios='OpenBSD 5.1' to override uname(3) as the source of the
default value for the mdoc(7) .Os macro.
Needed for man.cgi on the OpenBSD website.
Problem with man.cgi first noticed by deraadt@;
beck@ and deraadt@ agree with the way to solve the issue.
"Please check them in and I'll look into them later!" kristaps@
Diffstat (limited to 'read.c')
-rw-r--r-- | read.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -66,6 +66,7 @@ struct mparse { void *arg; /* argument to mmsg */ const char *file; struct buf *secondary; + char *defos; /* default operating system */ }; static void resize_buf(struct buf *, size_t); @@ -247,7 +248,8 @@ pset(const char *buf, int pos, struct mparse *curp) switch (curp->inttype) { case (MPARSE_MDOC): if (NULL == curp->pmdoc) - curp->pmdoc = mdoc_alloc(curp->roff, curp); + curp->pmdoc = mdoc_alloc(curp->roff, curp, + curp->defos); assert(curp->pmdoc); curp->mdoc = curp->pmdoc; return; @@ -263,7 +265,8 @@ pset(const char *buf, int pos, struct mparse *curp) if (pos >= 3 && 0 == memcmp(buf, ".Dd", 3)) { if (NULL == curp->pmdoc) - curp->pmdoc = mdoc_alloc(curp->roff, curp); + curp->pmdoc = mdoc_alloc(curp->roff, curp, + curp->defos); assert(curp->pmdoc); curp->mdoc = curp->pmdoc; return; @@ -720,7 +723,8 @@ mparse_readfd(struct mparse *curp, int fd, const char *file) } struct mparse * -mparse_alloc(enum mparset inttype, enum mandoclevel wlevel, mandocmsg mmsg, void *arg) +mparse_alloc(enum mparset inttype, enum mandoclevel wlevel, + mandocmsg mmsg, void *arg, char *defos) { struct mparse *curp; @@ -732,6 +736,7 @@ mparse_alloc(enum mparset inttype, enum mandoclevel wlevel, mandocmsg mmsg, void curp->mmsg = mmsg; curp->arg = arg; curp->inttype = inttype; + curp->defos = defos; curp->roff = roff_alloc(curp); return(curp); |