tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Reducing uname footer string on FreeBSD
@ 2010-06-09 16:34 Ulrich Spörlein
  2010-06-12 17:18 ` Ingo Schwarze
  2010-06-13 21:13 ` Joerg Sonnenberger
  0 siblings, 2 replies; 8+ messages in thread
From: Ulrich Spörlein @ 2010-06-09 16:34 UTC (permalink / raw)
  To: tech

[-- Attachment #1: Type: text/plain, Size: 692 bytes --]

Hi again,

the FreeBSD groff will only print the following information in the
footer:

% man ls|tail -1
FreeBSD 8.1                      April 4, 2008                     FreeBSD 8.1

While stock mandoc uses `uname -sr` output which is currently:
% uname -sr
FreeBSD 8.1-PRERELEASE

The attached patch clamps the string after the dash, iff uname reports
we are running on FreeBSD. I don't think such special casing should be
applied in the general source tree, but wanted to put it up for
discussion anyway.

Also, who decides what goes into lib.in and what the official library
string is going to be? Attached you'll also find the current diff I'm
using in my FreeBSD tree. Discuss! :)

Uli

[-- Attachment #2: uname.diff --]
[-- Type: text/x-diff, Size: 766 bytes --]

commit 7b6298d198c875c7d5036f0a8ad81c4a0ea194f9
Author: Ulrich Spörlein <uqs@spoerlein.net>
Date:   Mon May 24 16:50:14 2010 +0200

    mandoc: cut trailing OS string after first dash
    
    This is to mimick groff behaviour, where only "FreeBSD 8.0" is
    displayed in the footer.

diff --git a/contrib/mdocml/mdoc_action.c b/contrib/mdocml/mdoc_action.c
index f27ef13..ddd7cab 100644
--- a/contrib/mdocml/mdoc_action.c
+++ b/contrib/mdocml/mdoc_action.c
@@ -611,6 +611,8 @@ post_os(POST_ARGS)
 			mdoc_nmsg(m, n, MANDOCERR_MEM);
 			return(0);
 		}
+		if (strncmp(utsname.sysname, "FreeBSD", sizeof("FreeBSD")) == 0)
+			strtok(utsname.release, "-");
 		if (strlcat(buf, utsname.release, BUFSIZ) >= BUFSIZ) {
 			mdoc_nmsg(m, n, MANDOCERR_MEM);
 			return(0);

[-- Attachment #3: lib.diff --]
[-- Type: text/x-diff, Size: 5719 bytes --]

commit 72c92d22c4c7f5aace5b58a1ced761e32c48eee8
Author: Ulrich Spörlein <uqs@spoerlein.net>
Date:   Tue May 25 11:11:06 2010 +0200

    mandoc: add/update library strings from mdoc.local

diff --git a/contrib/mdocml/lib.in b/contrib/mdocml/lib.in
index 86fa55a..10fc05e 100644
--- a/contrib/mdocml/lib.in
+++ b/contrib/mdocml/lib.in
@@ -23,46 +23,72 @@
  * Be sure to escape strings.
  */
 
-LINE("libarchive",	"Reading and Writing Streaming Archives Library (libarchive, \\-larchive)")
+LINE("libarchive",	"Streaming Archive Library (libarchive, \\-larchive)")
 LINE("libarm",		"ARM Architecture Library (libarm, \\-larm)")
 LINE("libarm32",	"ARM32 Architecture Library (libarm32, \\-larm32)")
-LINE("libbluetooth",	"Bluetooth Library (libbluetooth, \\-lbluetooth)")
+LINE("libbluetooth",	"Bluetooth User Library (libbluetooth, \\-lbluetooth)")
+LINE("libbsm",		"Basic Security Module User Library (libbsm, \\-lbsm)")
 LINE("libc",		"Standard C Library (libc, \\-lc)")
+LINE("libc_r",		"Reentrant C\\~Library (libc_r, \\-lc_r)")
+LINE("libcalendar",	"Calendar Arithmetic Library (libcalendar, \\-lcalendar)")
+LINE("libcam",		"Common Access Method User Library (libcam, \\-lcam)")
 LINE("libcdk",		"Curses Development Kit Library (libcdk, \\-lcdk)")
+LINE("libcipher",	"FreeSec Crypt Library (libcipher, \\-lcipher)")
 LINE("libcompat",	"Compatibility Library (libcompat, \\-lcompat)")
 LINE("libcrypt",	"Crypt Library (libcrypt, \\-lcrypt)")
 LINE("libcurses",	"Curses Library (libcurses, \\-lcurses)")
-LINE("libedit",		"Command Line Editor Library (libedit, \\-ledit)")
+LINE("libdevinfo",	"Device and Resource Information Utility Library (libdevinfo, \\-ldevinfo)")
+LINE("libdevstat",	"Device Statistics Library (libdevstat, \\-ldevstat)")
+LINE("libdisk",		"Interface to Slice and Partition Labels Library (libdisk, \\-ldisk)")
+LINE("libedit",		"Line Editor and History Library (libedit, \\-ledit)")
+LINE("libefi",		"EFI Runtime Services Library (libefi, \\-lefi)")
 LINE("libelf",		"ELF Parsing Library (libelf, \\-lelf)")
 LINE("libevent",	"Event Notification Library (libevent, \\-levent)")
-LINE("libfetch",	"File Transfer Library for URLs (libfetch, \\-lfetch)")
+LINE("libfetch",	"File Transfer Library (libfetch, \\-lfetch)")
 LINE("libform",		"Curses Form Library (libform, \\-lform)")
+LINE("libgeom",		"Userland API Library for kernel GEOM subsystem (libgeom, \\-lgeom)")
+LINE("libgpib",		"General-Purpose Instrument Bus (GPIB) library (libgpib, \\-lgpib)")
 LINE("libi386",		"i386 Architecture Library (libi386, \\-li386)")
 LINE("libintl",		"Internationalized Message Handling Library (libintl, \\-lintl)")
 LINE("libipsec",	"IPsec Policy Control Library (libipsec, \\-lipsec)")
+LINE("libipx",		"IPX Address Conversion Support Library (libipx, \\-lipx)")
 LINE("libiscsi",	"iSCSI protocol library (libiscsi, \\-liscsi)")
+LINE("libjail",		"Jail Library (libjail, \\-ljail)")
+LINE("libkiconv",	"Kernel side iconv library (libkiconv, \\-lkiconv)")
+LINE("libkse",		"N:M Threading Library (libkse, \\-lkse)")
 LINE("libkvm",		"Kernel Data Access Library (libkvm, \\-lkvm)")
 LINE("libm",		"Math Library (libm, \\-lm)")
 LINE("libm68k",		"m68k Architecture Library (libm68k, \\-lm68k)")
 LINE("libmagic",	"Magic Number Recognition Library (libmagic, \\-lmagic)")
+LINE("libmd",		"Message Digest (MD4, MD5, etc.) Support Library (libmd, \\-lmd)")
+LINE("libmemstat",	"Kernel Memory Allocator Statistics Library (libmemstat, \\-lmemstat)")
 LINE("libmenu",		"Curses Menu Library (libmenu, \\-lmenu)")
+LINE("libnetgraph",	"Netgraph User Library (libnetgraph, \\-lnetgraph)")
 LINE("libnetpgp",	"Netpgp signing, verification, encryption and decryption (libnetpgp, \\-lnetpgp)")
 LINE("libossaudio",	"OSS Audio Emulation Library (libossaudio, \\-lossaudio)")
 LINE("libpam",		"Pluggable Authentication Module Library (libpam, \\-lpam)")
 LINE("libpcap",		"Capture Library (libpcap, \\-lpcap)")
 LINE("libpci",		"PCI Bus Access Library (libpci, \\-lpci)")
-LINE("libpmc",		"Performance Counters Library (libpmc, \\-lpmc)")
+LINE("libpmc",		"Performance Monitoring Counters Interface Library (libpmc, \\-lpmc)")
 LINE("libposix",	"POSIX Compatibility Library (libposix, \\-lposix)")
 LINE("libprop",		"Property Container Object Library (libprop, \\-lprop)")
 LINE("libpthread",	"POSIX Threads Library (libpthread, \\-lpthread)")
 LINE("libpuffs",	"puffs Convenience Library (libpuffs, \\-lpuffs)")
 LINE("librefuse",	"File System in Userspace Convenience Library (librefuse, \\-lrefuse)")
 LINE("libresolv",	"DNS Resolver Library (libresolv, \\-lresolv)")
+LINE("librpcsec_gss",	"RPC GSS-API Authentication Library (librpcsec_gss, \\-lrpcsec_gss)")
+LINE("librpcsvc",	"RPC Service Library (librpcsvc, \\-lrpcsvc)")
 LINE("librt",		"POSIX Real\\-time Library (librt, -lrt)")
+LINE("libsdp",		"Bluetooth Service Discovery Protocol User Library (libsdp, \\-lsdp)")
 LINE("libssp",		"Buffer Overflow Protection Library (libssp, \\-lssp)")
 LINE("libtermcap",	"Termcap Access Library (libtermcap, \\-ltermcap)")
 LINE("libterminfo",	"Terminal Information Library (libterminfo, \\-lterminfo)")
+LINE("libthr",		"1:1 Threading Library (libthr, \\-lthr)")
+LINE("libufs",		"UFS File System Access Library (libufs, \\-lufs)")
+LINE("libugidfw",	"File System Firewall Interface Library (libugidfw, \\-lugidfw)")
+LINE("libulog",		"User Login Record Library (libulog, \\-lulog)")
 LINE("libusbhid",	"USB Human Interface Devices Library (libusbhid, \\-lusbhid)")
 LINE("libutil",		"System Utilities Library (libutil, \\-lutil)")
+LINE("libvgl",		"Video Graphics Library (libvgl, \\-lvgl)")
 LINE("libx86_64",	"x86_64 Architecture Library (libx86_64, \\-lx86_64)")
 LINE("libz",		"Compression Library (libz, \\-lz)")

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reducing uname footer string on FreeBSD
  2010-06-09 16:34 Reducing uname footer string on FreeBSD Ulrich Spörlein
@ 2010-06-12 17:18 ` Ingo Schwarze
  2010-06-13 19:32   ` Kristaps Dzonsons
  2010-06-13 21:13 ` Joerg Sonnenberger
  1 sibling, 1 reply; 8+ messages in thread
From: Ingo Schwarze @ 2010-06-12 17:18 UTC (permalink / raw)
  To: tech

Hi Ulrich,

Ulrich Spörlein wrote on Wed, Jun 09, 2010 at 06:34:47PM +0200:

> The attached patch clamps the string after the dash, iff uname reports
> we are running on FreeBSD. I don't think such special casing should be
> applied in the general source tree, but wanted to put it up for
> discussion anyway.

Actually, i wouldn't even object to this particular patch going in
in case that's easier for you.  After all,

 - post_os() is typically called once per input file;
 - this is the central place where OS names are handled,
   so having differences here is not that surprising;
 - your patch is not expensive:  linear in the length
   of the string "FreeBSD" on FreeBSD, one return-at-once
   function call everywhere else.

So, even if all the four major free BSD implementations would
need something like this in post_os(), it would still seem
reasonable to me.

Yours,
  Ingo


> commit 7b6298d198c875c7d5036f0a8ad81c4a0ea194f9
> Author: Ulrich Spörlein <uqs@spoerlein.net>
> Date:   Mon May 24 16:50:14 2010 +0200
> 
>     mandoc: cut trailing OS string after first dash
>     
>     This is to mimick groff behaviour, where only "FreeBSD 8.0" is
>     displayed in the footer.
> 
> diff --git a/contrib/mdocml/mdoc_action.c b/contrib/mdocml/mdoc_action.c
> index f27ef13..ddd7cab 100644
> --- a/contrib/mdocml/mdoc_action.c
> +++ b/contrib/mdocml/mdoc_action.c
> @@ -611,6 +611,8 @@ post_os(POST_ARGS)
>  			mdoc_nmsg(m, n, MANDOCERR_MEM);
>  			return(0);
>  		}
> +		if (strncmp(utsname.sysname, "FreeBSD", sizeof("FreeBSD")) == 0)
> +			strtok(utsname.release, "-");
>  		if (strlcat(buf, utsname.release, BUFSIZ) >= BUFSIZ) {
>  			mdoc_nmsg(m, n, MANDOCERR_MEM);
>  			return(0);
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reducing uname footer string on FreeBSD
  2010-06-12 17:18 ` Ingo Schwarze
@ 2010-06-13 19:32   ` Kristaps Dzonsons
  2010-06-14 17:36     ` Ulrich Spörlein
  0 siblings, 1 reply; 8+ messages in thread
From: Kristaps Dzonsons @ 2010-06-13 19:32 UTC (permalink / raw)
  To: tech

>> The attached patch clamps the string after the dash, iff uname reports
>> we are running on FreeBSD. I don't think such special casing should be
>> applied in the general source tree, but wanted to put it up for
>> discussion anyway.
> 
> Actually, i wouldn't even object to this particular patch going in
> in case that's easier for you.  After all,
> 
>  - post_os() is typically called once per input file;
>  - this is the central place where OS names are handled,
>    so having differences here is not that surprising;
>  - your patch is not expensive:  linear in the length
>    of the string "FreeBSD" on FreeBSD, one return-at-once
>    function call everywhere else.
> 
> So, even if all the four major free BSD implementations would
> need something like this in post_os(), it would still seem
> reasonable to me.

Ulrich and Ingo, I have no objection to this being merged so long as you 
(Ulrich) can guarantee that this behaviour is general, i.e., that this 
will not cause badness in any sort of FreeBSD configuration.

Thanks,

Kristaps
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reducing uname footer string on FreeBSD
  2010-06-09 16:34 Reducing uname footer string on FreeBSD Ulrich Spörlein
  2010-06-12 17:18 ` Ingo Schwarze
@ 2010-06-13 21:13 ` Joerg Sonnenberger
  2010-06-14 17:32   ` Ulrich Spörlein
  1 sibling, 1 reply; 8+ messages in thread
From: Joerg Sonnenberger @ 2010-06-13 21:13 UTC (permalink / raw)
  To: tech

On Wed, Jun 09, 2010 at 06:34:47PM +0200, Ulrich Spörlein wrote:
> the FreeBSD groff will only print the following information in the
> footer:
> 
> % man ls|tail -1
> FreeBSD 8.1                      April 4, 2008                     FreeBSD 8.1
> 
> While stock mandoc uses `uname -sr` output which is currently:
> % uname -sr
> FreeBSD 8.1-PRERELEASE
> 
> The attached patch clamps the string after the dash, iff uname reports
> we are running on FreeBSD. I don't think such special casing should be
> applied in the general source tree, but wanted to put it up for
> discussion anyway.

Have you considered just using -DOSNAME="\"FreeBSD 8.1\""?

Joerg
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reducing uname footer string on FreeBSD
  2010-06-13 21:13 ` Joerg Sonnenberger
@ 2010-06-14 17:32   ` Ulrich Spörlein
  2010-06-14 19:34     ` Joerg Sonnenberger
  0 siblings, 1 reply; 8+ messages in thread
From: Ulrich Spörlein @ 2010-06-14 17:32 UTC (permalink / raw)
  To: tech

On Sun, 13.06.2010 at 23:13:20 +0200, Joerg Sonnenberger wrote:
> On Wed, Jun 09, 2010 at 06:34:47PM +0200, Ulrich Spörlein wrote:
> > the FreeBSD groff will only print the following information in the
> > footer:
> > 
> > % man ls|tail -1
> > FreeBSD 8.1                      April 4, 2008                     FreeBSD 8.1
> > 
> > While stock mandoc uses `uname -sr` output which is currently:
> > % uname -sr
> > FreeBSD 8.1-PRERELEASE
> > 
> > The attached patch clamps the string after the dash, iff uname reports
> > we are running on FreeBSD. I don't think such special casing should be
> > applied in the general source tree, but wanted to put it up for
> > discussion anyway.
> 
> Have you considered just using -DOSNAME="\"FreeBSD 8.1\""?

Yes, but this gets messy when you are running an older mandoc binary on
a newer FreeBSD release. It will simply display stale information and
this requires Makefile trickery I'd really like to avoid.

Uli
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reducing uname footer string on FreeBSD
  2010-06-13 19:32   ` Kristaps Dzonsons
@ 2010-06-14 17:36     ` Ulrich Spörlein
  0 siblings, 0 replies; 8+ messages in thread
From: Ulrich Spörlein @ 2010-06-14 17:36 UTC (permalink / raw)
  To: tech

On Sun, 13.06.2010 at 21:32:55 +0200, Kristaps Džonsons wrote:
> >> The attached patch clamps the string after the dash, iff uname reports
> >> we are running on FreeBSD. I don't think such special casing should be
> >> applied in the general source tree, but wanted to put it up for
> >> discussion anyway.
> > 
> > Actually, i wouldn't even object to this particular patch going in
> > in case that's easier for you.  After all,
> > 
> >  - post_os() is typically called once per input file;
> >  - this is the central place where OS names are handled,
> >    so having differences here is not that surprising;
> >  - your patch is not expensive:  linear in the length
> >    of the string "FreeBSD" on FreeBSD, one return-at-once
> >    function call everywhere else.
> > 
> > So, even if all the four major free BSD implementations would
> > need something like this in post_os(), it would still seem
> > reasonable to me.
> 
> Ulrich and Ingo, I have no objection to this being merged so long as you 
> (Ulrich) can guarantee that this behaviour is general, i.e., that this 
> will not cause badness in any sort of FreeBSD configuration.

I cannot think of any badness that this could trigger. groff(1) on
FreeBSD has been doing this for a very long time.

I will double check and commit if everything checks out.

Uli
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reducing uname footer string on FreeBSD
  2010-06-14 17:32   ` Ulrich Spörlein
@ 2010-06-14 19:34     ` Joerg Sonnenberger
  2010-06-14 20:22       ` Ulrich Spörlein
  0 siblings, 1 reply; 8+ messages in thread
From: Joerg Sonnenberger @ 2010-06-14 19:34 UTC (permalink / raw)
  To: tech

On Mon, Jun 14, 2010 at 07:32:56PM +0200, Ulrich Spörlein wrote:
> > Have you considered just using -DOSNAME="\"FreeBSD 8.1\""?
> 
> Yes, but this gets messy when you are running an older mandoc binary on
> a newer FreeBSD release. It will simply display stale information and
> this requires Makefile trickery I'd really like to avoid.

Yes, but it is not different from the situation you currently have
w.r.t. groff if you consider /usr/share/tmac part of the binary.
That said, I found the version number never very useful at all for the
same reason.

Joerg
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reducing uname footer string on FreeBSD
  2010-06-14 19:34     ` Joerg Sonnenberger
@ 2010-06-14 20:22       ` Ulrich Spörlein
  0 siblings, 0 replies; 8+ messages in thread
From: Ulrich Spörlein @ 2010-06-14 20:22 UTC (permalink / raw)
  To: tech

On Mon, 14.06.2010 at 21:34:57 +0200, Joerg Sonnenberger wrote:
> On Mon, Jun 14, 2010 at 07:32:56PM +0200, Ulrich Spörlein wrote:
> > > Have you considered just using -DOSNAME="\"FreeBSD 8.1\""?
> > 
> > Yes, but this gets messy when you are running an older mandoc binary on
> > a newer FreeBSD release. It will simply display stale information and
> > this requires Makefile trickery I'd really like to avoid.
> 
> Yes, but it is not different from the situation you currently have
> w.r.t. groff if you consider /usr/share/tmac part of the binary.
> That said, I found the version number never very useful at all for the
> same reason.

It is indeed pretty pointless when running man(1), but comes in very
handy when you look at HTML renderings of manpages somewhere on the web.

I will keep the diff local for now, the special casing isn't worthwhile
unless there's demand.

Uli
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-06-14 20:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-09 16:34 Reducing uname footer string on FreeBSD Ulrich Spörlein
2010-06-12 17:18 ` Ingo Schwarze
2010-06-13 19:32   ` Kristaps Dzonsons
2010-06-14 17:36     ` Ulrich Spörlein
2010-06-13 21:13 ` Joerg Sonnenberger
2010-06-14 17:32   ` Ulrich Spörlein
2010-06-14 19:34     ` Joerg Sonnenberger
2010-06-14 20:22       ` Ulrich Spörlein

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).