tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: tech@mdocml.bsd.lv
Subject: Re: Reducing uname footer string on FreeBSD
Date: Sat, 12 Jun 2010 19:18:44 +0200	[thread overview]
Message-ID: <20100612171844.GE6086@iris.usta.de> (raw)
In-Reply-To: <20100609163447.GA39829@acme.spoerlein.net>

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

  reply	other threads:[~2010-06-12 17:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09 16:34 Ulrich Spörlein
2010-06-12 17:18 ` Ingo Schwarze [this message]
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

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=20100612171844.GE6086@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=tech@mdocml.bsd.lv \
    /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).