aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-12-28 14:42:27 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-12-28 14:42:27 +0000
commit6d601f57d01308c8dcd7d348a05eaf33f9f1b9ce (patch)
tree085c053e6a6fb2e3d0413f31ef56ea03bfbc9772
parentf39353f2335ef79f686c763d3cc3777bf474dacc (diff)
downloadmandoc-6d601f57d01308c8dcd7d348a05eaf33f9f1b9ce.tar.gz
mandoc-6d601f57d01308c8dcd7d348a05eaf33f9f1b9ce.tar.zst
mandoc-6d601f57d01308c8dcd7d348a05eaf33f9f1b9ce.zip
mdoc(7) already uses the mandoc(1) -Ios argument in the footer line
when .Os has no argument, so do the same for man(7) when .TH has less than four arguments; there is no reason to treat both differently. Issue found following a question from Thomas Klausner <wiz at NetBSD>.
-rw-r--r--libman.h3
-rw-r--r--libmandoc.h5
-rw-r--r--man.17
-rw-r--r--man.c6
-rw-r--r--man_validate.c2
-rw-r--r--mandoc.17
-rw-r--r--read.c11
7 files changed, 28 insertions, 13 deletions
diff --git a/libman.h b/libman.h
index b26c2b60..8d115b3a 100644
--- a/libman.h
+++ b/libman.h
@@ -1,4 +1,4 @@
-/* $Id: libman.h,v 1.66 2014/12/01 04:05:31 schwarze Exp $ */
+/* $Id: libman.h,v 1.67 2014/12/28 14:42:27 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 d9cc72f6..e4a25ba4 100644
--- a/libmandoc.h
+++ b/libmandoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmandoc.h,v 1.52 2014/12/21 14:14:35 schwarze Exp $ */
+/* $Id: libmandoc.h,v 1.53 2014/12/28 14:42:27 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 65db3861..7ec0f5de 100644
--- a/man.1
+++ b/man.1
@@ -1,4 +1,4 @@
-.\" $Id: man.1,v 1.9 2014/12/18 21:11:46 schwarze Exp $
+.\" $Id: man.1,v 1.10 2014/12/28 14:42:27 schwarze Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -31,7 +31,7 @@
.\"
.\" @(#)man.1 8.2 (Berkeley) 1/2/94
.\"
-.Dd $Mdocdate: December 18 2014 $
+.Dd $Mdocdate: December 28 2014 $
.Dt MAN 1
.Os
.Sh NAME
@@ -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 048db26f..766272d9 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.145 2014/11/28 06:27:05 schwarze Exp $ */
+/* $Id: man.c,v 1.146 2014/12/28 14:42:27 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 248a60f5..6ca3ec36 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.129 2014/12/16 23:44:41 schwarze Exp $
+.\" $Id: mandoc.1,v 1.130 2014/12/28 14:42:27 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 16 2014 $
+.Dd $Mdocdate: December 28 2014 $
.Dt MANDOC 1
.Os
.Sh NAME
@@ -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 ce7b094e..703e949a 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.105 2014/12/16 23:44:41 schwarze Exp $ */
+/* $Id: read.c,v 1.106 2014/12/28 14:42:27 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);