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

From: Michael Forney <mforney_AT_mforney.org>
Date: Mon, 20 May 2019 19:06:04 -0700

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.
Received on Tue May 21 2019 - 04:06:04 CEST

This archive was generated by hypermail 2.3.0 : Tue May 21 2019 - 04:12:22 CEST