🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.d
Article #1771

Re: v01INF1: Status - Status of comp.sources.reviewed

#1771
From: Peter da Silva
Date: Fri, 19 Apr 1991 15:13
32 lines
1643 bytes
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().

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);
}

#ifdef NO_BUILT_IN_PERROR
perror(s)
{
	fprintf(stderr, "%s\n", s)
}
#endif

/* example: if(!fp) errmsg(filename, "Can't open %s for reading"); */
-- 
Peter da Silva.  `-_-'  peter@ferranti.com
+1 713 274 5180.  'U`  "Have you hugged your wolf today?"
Technical Details
Message-ID: <B9UA6DD@xds13.ferranti.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!emory!wuarchive!rex!ukma!hsdndev!cmcl2!uupsi!ficc!peter
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>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!emory!wuarchive!rex!ukma!hsdndev!cmcl2!uupsi!ficc!peter
From: peter@ficc.ferranti.com (Peter da Silva)
Newsgroups: comp.sources.d
Subject: Re: v01INF1: Status - Status of comp.sources.reviewed
Message-ID: <B9UA6DD@xds13.ferranti.com>
Date: 19 Apr 91 15:13:10 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>
Reply-To: peter@ficc.ferranti.com (Peter da Silva)
Organization: Xenix Support, FICC
Lines: 32