From: Ingo Schwarze <schwarze@usta.de>
To: Thomas Klausner <wiz@NetBSD.org>
Cc: discuss@mdocml.bsd.lv
Subject: Re: override operating system version
Date: Wed, 17 Dec 2014 18:27:00 +0100 [thread overview]
Message-ID: <20141217172700.GA19376@iris.usta.de> (raw)
In-Reply-To: <20141217133520.GZ1188@danbala.tuwien.ac.at>
Hi Thomas,
Thomas Klausner wrote on Wed, Dec 17, 2014 at 02:35:20PM +0100:
> For displaying man pages from older releases on man.netbsd.org,
> we'd like to override the default operating system version put
> into the man page footer. mandoc currently uses the one from
> the operating system on which mandoc is running.
That only applies to mdoc(7) pages, and only if -Ios is not given
on the command line and -DOSNAME is not given at compile time.
For man(7) pages, it is left blank by default, and right now,
that default cannot be overridden, neither at compile time nor
from the command line.
> Using groff, the workaround is to set GROFF_TMAC_PATH to a copy
> of the tmac files from that release.
That sounds like it involves NetBSD-specific customizations.
Stock upstream groff defaults to "BSD" for mdoc(7) and a blank
field for man(7), iirc.
> What's the best way to do that with mandoc?
The easiest way seems to let man(7) use the existing -Ios command
line option just like mdoc(7). I mean, the user will hardly care
what the language of the manual page's source code is, so it's
hard to see why the two should be different.
Obviously, man.cgi(8) has no command line options, but it uses
the manpath of the page being shown - for example "NetBSD-6.1.5" in
http://mdocml.bsd.lv/cgi-bin/man.cgi?query=man&manpath=NetBSD-6.1.5 -
for the purpose man(1) and mandoc(1) use -Ios.
If you like that approach, i'll probably commit it.
Yours,
Ingo
Index: libman.h
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/libman.h,v
retrieving revision 1.41
diff -u -p -r1.41 libman.h
--- libman.h 28 Nov 2014 05:51:29 -0000 1.41
+++ libman.h 17 Dec 2014 17:11:17 -0000
@@ -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. */
Index: libmandoc.h
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/libmandoc.h,v
retrieving revision 1.37
diff -u -p -r1.37 libmandoc.h
--- libmandoc.h 1 Dec 2014 08:05:02 -0000 1.37
+++ libmandoc.h 17 Dec 2014 17:11:17 -0000
@@ -64,7 +64,8 @@ void mdoc_addspan(struct mdoc *, const
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 *);
Index: man.1
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/man.1,v
retrieving revision 1.6
diff -u -p -r1.6 man.1
--- man.1 14 Dec 2014 17:48:48 -0000 1.6
+++ man.1 17 Dec 2014 17:11:17 -0000
@@ -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.
Index: man.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/man.c,v
retrieving revision 1.93
diff -u -p -r1.93 man.c
--- man.c 28 Nov 2014 06:26:46 -0000 1.93
+++ man.c 17 Dec 2014 17:11:17 -0000
@@ -90,7 +90,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;
@@ -98,6 +99,7 @@ man_alloc(struct roff *roff, struct mpar
man_hash_init();
p->parse = parse;
+ p->defos = defos;
p->quick = quick;
p->roff = roff;
Index: man_validate.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/man_validate.c,v
retrieving revision 1.78
diff -u -p -r1.78 man_validate.c
--- man_validate.c 28 Nov 2014 05:51:29 -0000 1.78
+++ man_validate.c 17 Dec 2014 17:11:17 -0000
@@ -377,6 +377,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. */
Index: mandoc.1
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mandoc.1,v
retrieving revision 1.69
diff -u -p -r1.69 mandoc.1
--- mandoc.1 15 Dec 2014 17:36:47 -0000 1.69
+++ mandoc.1 17 Dec 2014 17:11:17 -0000
@@ -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.
Index: read.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/read.c,v
retrieving revision 1.80
diff -u -p -r1.80 read.c
--- read.c 16 Dec 2014 23:44:16 -0000 1.80
+++ read.c 17 Dec 2014 17:11:17 -0000
@@ -293,7 +293,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;
@@ -689,7 +690,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;
}
@@ -918,7 +920,8 @@ mparse_alloc(int options, enum mandoclev
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);
--
To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv
next prev parent reply other threads:[~2014-12-17 17:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 13:35 Thomas Klausner
2014-12-17 17:27 ` Ingo Schwarze [this message]
2014-12-25 23:15 ` Thomas Klausner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141217172700.GA19376@iris.usta.de \
--to=schwarze@usta.de \
--cc=discuss@mdocml.bsd.lv \
--cc=wiz@NetBSD.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).