delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/02/27/12:04:05.1

Message-ID: <3E5E4153.5EBAB24A@yahoo.com>
Date: Thu, 27 Feb 2003 11:48:19 -0500
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: perror
References: <20030227150458 DOT GA3476 AT kendall DOT sfbr DOT org> <1046360051 DOT 30750 DOT 3 DOT camel AT leeloo> <20030227155759 DOT GA3540 AT kendall DOT sfbr DOT org>
Reply-To: djgpp-workers AT delorie DOT com

JT Williams wrote:
> 
> Second version of perror.c patch:
> 
> --- perror.orig 1994-12-10 21:52:02.000000000 -0600
> +++ perror.c    2003-02-27 09:52:48.223807000 -0600
> @@ -6,5 +6,7 @@
>  void
>  perror(const char *s)
>  {
> -  fprintf(stderr, "%s: %s\n", s, strerror(errno));
> +  if ((s && *s) || (strcmp(s, "") == 0))
> +    fprintf(stderr, "%s: ", s);
> +  fprintf(stderr, "%s\n", strerror(errno));
>  }

That executes strcmp(NULL, "").  *s took care of it.

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


- Raw text -


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