From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-01-web.scc.kit.edu (scc-mailout-kit-01-web.scc.kit.edu [129.13.231.93]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id eb8131d9; for ; Wed, 17 Dec 2014 12:27:06 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-01.scc.kit.edu with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (envelope-from ) id 1Y1INK-0008JA-1H; Wed, 17 Dec 2014 18:27:03 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1Y1INJ-0007f7-RH; Wed, 17 Dec 2014 18:27:01 +0100 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1Y1INJ-0002yW-PW; Wed, 17 Dec 2014 18:27:01 +0100 Received: from schwarze by usta.de with local (Exim 4.77) (envelope-from ) id 1Y1INJ-0002Xs-EG; Wed, 17 Dec 2014 18:27:01 +0100 Date: Wed, 17 Dec 2014 18:27:00 +0100 From: Ingo Schwarze To: Thomas Klausner Cc: discuss@mdocml.bsd.lv Subject: Re: override operating system version Message-ID: <20141217172700.GA19376@iris.usta.de> References: <20141217133520.GZ1188@danbala.tuwien.ac.at> X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141217133520.GZ1188@danbala.tuwien.ac.at> User-Agent: Mutt/1.5.21 (2010-09-15) 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