Article View: comp.sources.d
Article #1773Re: v01INF1: Status - Status of comp.sources.reviewed
From: Michael Meissner
Date: Sat, 20 Apr 1991 19:14
Date: Sat, 20 Apr 1991 19:14
34 lines
2048 bytes
2048 bytes
In article <B9UA6DD@xds13.ferranti.com> peter@ficc.ferranti.com (Peter
da Silva) writes:
| In article <25835:Apr1908:41:2991@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
| > While I'd love to pretend that most compilers ``out there'' are ANSI C
| > (and UNIX and a VAX and...), I don't want to keep my code from working
| > on the vast majority of implementations. I was under the impression that
| > some environments either do not provide perror() or do not set errors in
| > stdio; if perror() is universally available, I'll gladly recode the
| > error messages around sprintf() and perror().
Perror has been in Unix since V7. Strerror on the other hand is a
creation of the ANSI committee.
| errmsg(object, context)
| char *object;
| char *context;
| {
| extern perror();
| char buffer[256]; /* or however big you want it */
| extern char *progname;
|
| sprintf(buffer, "%s: ", progname);
| sprintf(buffer+strlen(buffer), context, object);
| perror(buffer);
| }
This can produce the wrong error message if sprintf sets errno (for
example if it calls malloc and malloc fails).
--
Michael Meissner email: meissner@osf.org phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142
Considering the flames and intolerance, shouldn't USENET be spelled ABUSENET?
Technical Details
Message-ID:
<MEISSNER.91Apr20151434@curley.osf.org>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!paperboy!meissnerReferences:
<1991Apr16.131650.24389@scuzzy.in-berlin.de> <1307:Apr1702:20:0991@kramden.acf.nyu.edu> <FUSA56C@xds13.ferranti.com> <25835:Apr1908:41:2991@kramden.acf.nyu.edu> <B9UA6DD@xds13.ferranti.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!paperboy!meissner From: meissner@osf.org (Michael Meissner) Newsgroups: comp.sources.d Subject: Re: v01INF1: Status - Status of comp.sources.reviewed Message-ID: <MEISSNER.91Apr20151434@curley.osf.org> Date: 20 Apr 91 19:14:34 GMT References: <1991Apr16.131650.24389@scuzzy.in-berlin.de> <1307:Apr1702:20:0991@kramden.acf.nyu.edu> <FUSA56C@xds13.ferranti.com> <25835:Apr1908:41:2991@kramden.acf.nyu.edu> <B9UA6DD@xds13.ferranti.com> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 34 In-reply-to: peter@ficc.ferranti.com's message of 19 Apr 91 15:13:10 GMT