Mail Archives: djgpp-workers/2003/02/27/10:07:06

Date: Thu, 27 Feb 2003 10:07:05 -0500
Message-Id: <>
X-Authentication-Warning: dj set sender to dj AT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp-workers AT delorie DOT com
In-reply-to: <> (message from JT
Williams on Thu, 27 Feb 2003 09:04:58 -0600)
Subject: Re: perror
References: <20030227150458 DOT GA3476 AT kendall DOT sfbr DOT org>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> -  fprintf(stderr, "%s: %s\n", s, strerror(errno));
> +  if (s)
> +    fprintf(stderr, "%s: %s\n", s, strerror(errno));
> +  else
> +    fprintf(stderr, "%s\n", s, strerror(errno));
>  }

Better would be like this:

  if (s)
    fprintf(stderr, "%s: ", s);
  fprintf(stderr, "%s\n", strerror(errno));

That cuts down on duplication.  Go ahead and check it in.

> (The manpage says only that the colon is not printed; should the
> blank still be printed?)

I would say that the blank should not be printed if the colon is not.

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019