| delorie.com/archives/browse.cgi | search |
| Date: | Thu, 27 Feb 2003 10:07:05 -0500 |
| Message-Id: | <200302271507.h1RF75W26007@envy.delorie.com> |
| X-Authentication-Warning: | envy.delorie.com: 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: | <20030227150458.GA3476@kendall.sfbr.org> (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.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |