aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/read.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2012-05-27 17:48:57 +0000
committerIngo Schwarze <schwarze@openbsd.org>2012-05-27 17:48:57 +0000
commit5924b5736a3bec0c2ef93ddbd1da733745942d59 (patch)
tree1df37aca7cb87b5dba851f42f6052cdfcb19f89b /read.c
parent75264eae65dc293d4a49cd965f67b124bc6fb138 (diff)
downloadmandoc-5924b5736a3bec0c2ef93ddbd1da733745942d59.tar.gz
mandoc-5924b5736a3bec0c2ef93ddbd1da733745942d59.tar.zst
mandoc-5924b5736a3bec0c2ef93ddbd1da733745942d59.zip
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.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/read.c b/read.c
index 5b14e357..5b51091c 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.28 2012/02/16 20:51:31 joerg Exp $ */
+/* $Id: read.c,v 1.29 2012/05/27 17:48:57 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);