--- ray/src/common/error.c 1997/12/02 15:54:44 2.5 +++ ray/src/common/error.c 2003/07/27 22:12:01 2.10 @@ -1,32 +1,34 @@ -/* 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.10 2003/07/27 22:12:01 schorsch Exp $"; #endif - /* * error.c - standard error reporting function + * + * External symbols declared in standard.h */ -#include "standard.h" +#include "copyright.h" -#ifndef linux -extern char *sys_errlist[]; /* system error list */ -extern int sys_nerr; /* number of system errors */ -#endif +#include +#include + +#include "rterror.h" + +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; { register struct erract *ep; - if (etype < 0 | etype >= NERRS) + if ((etype < 0) | (etype >= NERRS)) return; ep = erract + etype; if (ep->pf != NULL) { @@ -34,10 +36,7 @@ char *emsg; 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"); }