Path: 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: Date: 19 Apr 91 15:13:10 GMT References: <1991Apr16.131650.24389@scuzzy.in-berlin.de> <1307:Apr1702:20:0991@kramden.acf.nyu.edu> <25835:Apr1908:41:2991@kramden.acf.nyu.edu> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 32 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?"