summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libman.h1
-rw-r--r--libmandoc.h3
-rw-r--r--man.13
-rw-r--r--man.c4
-rw-r--r--man_validate.c2
-rw-r--r--mandoc.13
-rw-r--r--read.c9
7 files changed, 20 insertions, 5 deletions
diff --git a/libman.h b/libman.h
index d29cfa36..283dafc7 100644
--- a/libman.h
+++ b/libman.h
@@ -23,6 +23,7 @@ enum man_next {
struct man {
struct mparse *parse; /* parse pointer */
+ const char *defos; /* default OS argument for .TH */
int quick; /* abort parse early */
int flags; /* parse flags */
#define MAN_ELINE (1 << 1) /* Next-line element scope. */
diff --git a/libmandoc.h b/libmandoc.h
index e5b52efd..71b9bb3f 100644
--- a/libmandoc.h
+++ b/libmandoc.h
@@ -66,7 +66,8 @@ void mdoc_addspan(struct mdoc *, const struct tbl_span *);
void mdoc_addeqn(struct mdoc *, const struct eqn *);
void man_free(struct man *);
-struct man *man_alloc(struct roff *, struct mparse *, int);
+struct man *man_alloc(struct roff *, struct mparse *,
+ const char *, int);
void man_reset(struct man *);
int man_parseln(struct man *, int, char *, int);
int man_endparse(struct man *);
diff --git a/man.1 b/man.1
index 88ac444e..29771ea1 100644
--- a/man.1
+++ b/man.1
@@ -106,6 +106,9 @@ Override the default operating system
for the
.Xr mdoc 7
.Ic \&Os
+and for the
+.Xr man 7
+.Ic \&TH
macro.
.It Fl h
Display only the SYNOPSIS lines of the requested manual pages.
diff --git a/man.c b/man.c
index bc634341..8e8cf725 100644
--- a/man.c
+++ b/man.c
@@ -92,7 +92,8 @@ man_free(struct man *man)
}
struct man *
-man_alloc(struct roff *roff, struct mparse *parse, int quick)
+man_alloc(struct roff *roff, struct mparse *parse,
+ const char *defos, int quick)
{
struct man *p;
@@ -100,6 +101,7 @@ man_alloc(struct roff *roff, struct mparse *parse, int quick)
man_hash_init();
p->parse = parse;
+ p->defos = defos;
p->quick = quick;
p->roff = roff;
diff --git a/man_validate.c b/man_validate.c
index 5688bb54..48f2ed5b 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -379,6 +379,8 @@ post_TH(CHKARGS)
if (n && (n = n->next))
man->meta.source = mandoc_strdup(n->string);
+ else if (man->defos != NULL)
+ man->meta.source = mandoc_strdup(man->defos);
/* TITLE MSEC DATE SOURCE ->VOL<- */
/* If missing, use the default VOL name for MSEC. */
diff --git a/mandoc.1 b/mandoc.1
index 5b55b728..65487dba 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -85,6 +85,9 @@ Override the default operating system
for the
.Xr mdoc 7
.Sq \&Os
+and for the
+.Xr man 7
+.Sq \&TH
macro.
.It Fl h
Display only the SYNOPSIS lines.
diff --git a/read.c b/read.c
index 9b266090..acf1c1e5 100644
--- a/read.c
+++ b/read.c
@@ -298,7 +298,8 @@ choose_parser(struct mparse *curp)
/* Fall back to man(7) as a last resort. */
if (NULL == curp->pman)
- curp->pman = man_alloc(curp->roff, curp,
+ curp->pman = man_alloc(
+ curp->roff, curp, curp->defos,
MPARSE_QUICK & curp->options ? 1 : 0);
assert(curp->pman);
curp->man = curp->pman;
@@ -696,7 +697,8 @@ mparse_end(struct mparse *curp)
curp->mdoc = curp->pmdoc;
else {
if (curp->pman == NULL)
- curp->pman = man_alloc(curp->roff, curp,
+ curp->pman = man_alloc(
+ curp->roff, curp, curp->defos,
curp->options & MPARSE_QUICK ? 1 : 0);
curp->man = curp->pman;
}
@@ -940,7 +942,8 @@ mparse_alloc(int options, enum mandoclevel wlevel, mandocmsg mmsg,
curp->roff, curp, curp->defos,
curp->options & MPARSE_QUICK ? 1 : 0);
if (curp->options & MPARSE_MAN)
- curp->pman = man_alloc(curp->roff, curp,
+ curp->pman = man_alloc(
+ curp->roff, curp, curp->defos,
curp->options & MPARSE_QUICK ? 1 : 0);
return(curp);