diff options
-rw-r--r-- | libman.h | 1 | ||||
-rw-r--r-- | libmandoc.h | 3 | ||||
-rw-r--r-- | man.1 | 3 | ||||
-rw-r--r-- | man.c | 4 | ||||
-rw-r--r-- | man_validate.c | 2 | ||||
-rw-r--r-- | mandoc.1 | 3 | ||||
-rw-r--r-- | read.c | 9 |
7 files changed, 20 insertions, 5 deletions
@@ -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 *); @@ -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. @@ -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. */ @@ -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. @@ -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); |