[illumos-Developer] Webrev for bug 844: m4 should say something useful...

Garrett D'Amore garrett at damore.org
Sun Apr 3 14:58:24 PDT 2011


On Sun, 2011-04-03 at 10:40 -0500, Gary Mills wrote:
> On Sat, Apr 02, 2011 at 06:42:34PM -0400, Richard Lowe wrote:
> > On Sat, Apr 2, 2011 at 15:56, Gary Mills <mills at cc.umanitoba.ca> wrote:
> > >    usr/src/cmd/sgs/m4/i386/m4:sample.m4:2 cannot open file, reason: Ce fichier ou ce répertoire n'existe pas
> > >    include(foobar.m4)
> > >
> > > Obviously the first phrase is not translated.  How do we correct that?
> > 
> > If you were remove the ", reason" from your text and give the
> > traditional "cannot open file: %s\n", it'll likely be translated
> > because that text is already in the SUNW_OST_OSCMD catalog.  I'd like
> > you to do that anyway, because it's the common way to format those
> > messages.
> 
> Okay, there's a new webrev at:
> 
>     http://cr.illumos.org/view/k9zwpc1c/illumos844-1/
> 
> that uses the string you recommended.  Here's how it looks now:
> 
>     $ usr/src/cmd/sgs/m4/i386/m4 sample.m4
>     
>     usr/src/cmd/sgs/m4/i386/m4:sample.m4:2 cannot open file: No such file or directory
>     
>     include(foobar.m4)
>     $ env LC_MESSAGES=fr_CA.UTF-8 usr/src/cmd/sgs/m4/i386/m4 samp>
>     
>     usr/src/cmd/sgs/m4/i386/m4:sample.m4:2 impossible d'ouvrir le fichier : Ce fichier ou ce répertoire n'existe pas
> 
>     include(foobar.m4)
> 
> It is translated now.  Because of the `\n' in the new string, there is
> an extra newline in the error message.  I'm not concerned about that.

Huh?  There should only be one new line.


> 
> Is this change ready to go now?
> 

I'd like to understand what you meant by an "extra" newline.  The code
looks good to me, though honestly I'd have simply opted for perror(3c)
instead of inventing a new function. E.g.

	if (fopen(...) == NULL) {
		perror(gettext("cannot open file"));
		...
	}

perror looks up the errno for you, and also dumps the result to stderr.

If you don't to make the switch to use perror, that's OK, its just not
quite as simple/clean as if you use perror().

	- Garrett




More information about the Developer mailing list