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

X-Authentication-Warning: jeffw set sender to jeffw AT darwin DOT sfbr DOT org using -f
Date: Thu, 27 Feb 2003 09:04:58 -0600
From: JT Williams <jeffw AT darwin DOT sfbr DOT org>
To: djgpp-workers AT delorie DOT com
Subject: perror
Message-ID: <>
Mail-Followup-To: djgpp-workers AT delorie DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.4i
Reply-To: djgpp-workers AT delorie DOT com

I happened to see this in the Solaris man page for `errno':

     The perror() function produces a  message  on  the  standard
     error  output.... 
     The  argument string s is printed, followed by a colon and a
     blank, followed by the message and a NEWLINE character.   If
     s is a null pointer or points to a null string, the colon is
     not printed.

So perhaps this patch to our perror.c is in order?  (The manpage says
only that the colon is not printed; should the blank still be printed?)

--- perror.orig 1994-12-10 21:52:02.000000000 -0600
+++ perror.c    2003-02-27 08:58:59.960438000 -0600
@@ -6,5 +6,8 @@
 perror(const char *s)
-  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));

- Raw text -

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