Re: [hackers] [PATCH][sbase] cmp: Make output POSIX compliant

From: Richard Ipsum <richardipsum_AT_fastmail.co.uk>
Date: Sun, 19 May 2019 20:42:18 +0100

On Sun, May 19, 2019 at 11:25:05AM -0700, Michael Forney wrote:
> On 2019-05-19, Richard Ipsum <richardipsum_AT_fastmail.co.uk> wrote:
> > From POSIX:
> >
[snip]
> > - weprintf("cmp: EOF on %s\n", argv[(b[0] != EOF)]);
> > + printf("cmp: EOF on %s\n", argv[(b[0] != EOF)]);
>
> I think stderr is correct for this message:
>
> The standard error shall be used only for diagnostic messages. ... in
> the POSIX locale the following diagnostic message shall be written
>
> However, we probably want to avoid the double-prefix on the message with just
>
> weprintf("EOF on %s\n", argv[(b[0] != EOF)]);

Sorry I wasn't paying enough attention to the man page.
This should be on stderr, but weprintf won't always produce the right output,
since argv0 might not be equal to "cmp".

Thanks,
Richard
Received on Sun May 19 2019 - 21:42:18 CEST

This archive was generated by hypermail 2.3.0 : Sun May 19 2019 - 21:48:23 CEST