--- ray/src/common/error.c 1997/11/11 19:02:15 2.4 +++ ray/src/common/error.c 2003/02/25 02:47:21 2.7 @@ -1,25 +1,24 @@ -/* Copyright (c) 1991 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: error.c,v 2.7 2003/02/25 02:47:21 greg Exp $"; #endif - /* * error.c - standard error reporting function + * + * External symbols declared in standard.h */ +#include "copyright.h" + #include "standard.h" -#ifndef linux -extern char *sys_errlist[]; /* system error list */ -extern int sys_nerr; /* number of system errors */ -#endif +extern char *strerror(); /* global list of error actions */ struct erract erract[NERRS] = ERRACT_INIT; char errmsg[512]; /* global error message buffer */ +void error(etype, emsg) /* report error, quit if necessary */ int etype; char *emsg; @@ -30,14 +29,11 @@ char *emsg; return; ep = erract + etype; if (ep->pf != NULL) { - (*ep->pf)(ep->pre); - (*ep->pf)(emsg); + if (ep->pre[0]) (*ep->pf)(ep->pre); + if (emsg != NULL && emsg[0]) (*ep->pf)(emsg); if (etype == SYSTEM && errno > 0) { (*ep->pf)(": "); - if (errno <= sys_nerr) - (*ep->pf)(sys_errlist[errno]); - else - (*ep->pf)("Unknown error"); + (*ep->pf)(strerror(errno)); } (*ep->pf)("\n"); }