Re: [hackers] [PATCH v3][sbase] cmp: Make output of error message POSIX compliant

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue, 21 May 2019 09:19:55 +0200

On Tue, May 21, 2019 at 05:37:27AM +0100, Richard Ipsum wrote:
> On Mon, May 20, 2019 at 07:06:04PM -0700, Michael Forney wrote:
> > On 2019-05-20, Laslo Hunhold <dev_AT_frign.de> wrote:
> > > On Mon, 20 May 2019 09:36:32 +0100
> > > Richard Ipsum <richardipsum_AT_fastmail.co.uk> wrote:
> > >
> > > Dear Richard,
> > >
> > >> - weprintf("cmp: EOF on %s\n",
> > >> argv[(b[0] != EOF)]);
> > >> + fprintf(stderr, "cmp: EOF on %s\n",
> > >
> > > maybe I am missing something, but weprintf() already does print to
> > > stderr. What does this patch change?
> >
> > weprintf also adds a prefix "%s: ", argv0, so we end up with a double prefix
> >
> > cmp: cmp: EOF on ...
> >
> > I think Richard is using fprintf directly since POSIX specifies that
> > the message should be exactly
> >
> > "cmp: EOF on %s%s\n", <name of shorter file>, <additional info>
> >
> > which might not be the case if cmp is called by its absolute path.
> >
>
> Exactly
>
> Thanks,
> Richard
>

Have you compared it to other implementations? I think it should output to stdout.

I'd also prefer to use the exact line format because POSIX specifies it.
I think many understand the difference between char and wchar anyway.

-- 
Kind regards,
Hiltjo
Received on Tue May 21 2019 - 09:19:55 CEST

This archive was generated by hypermail 2.3.0 : Tue May 21 2019 - 09:24:24 CEST