ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/error.c
(Generate patch)

Comparing ray/src/common/error.c (file contents):
Revision 2.5 by gregl, Tue Dec 2 15:54:44 1997 UTC vs.
Revision 2.10 by schorsch, Sun Jul 27 22:12:01 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  error.c - standard error reporting function
6 + *
7 + *  External symbols declared in standard.h
8   */
9  
10 < #include  "standard.h"
10 > #include "copyright.h"
11  
12 < #ifndef linux
13 < extern char  *sys_errlist[];    /* system error list */
14 < extern int  sys_nerr;           /* number of system errors */
15 < #endif
12 > #include  <stdio.h>
13 > #include  <stdlib.h>
14 >
15 > #include  "rterror.h"
16 >
17 > extern char     *strerror();
18                                  /* global list of error actions */
19   struct erract   erract[NERRS] = ERRACT_INIT;
20  
21   char  errmsg[512];              /* global error message buffer */
22  
23  
24 + void
25   error(etype, emsg)              /* report error, quit if necessary */
26   int  etype;
27   char  *emsg;
28   {
29          register struct erract  *ep;
30  
31 <        if (etype < 0 | etype >= NERRS)
31 >        if ((etype < 0) | (etype >= NERRS))
32                  return;
33          ep = erract + etype;
34          if (ep->pf != NULL) {
# Line 34 | Line 36 | char  *emsg;
36                  if (emsg != NULL && emsg[0]) (*ep->pf)(emsg);
37                  if (etype == SYSTEM && errno > 0) {
38                          (*ep->pf)(": ");
39 <                        if (errno <= sys_nerr)
38 <                                (*ep->pf)(sys_errlist[errno]);
39 <                        else
40 <                                (*ep->pf)("Unknown error");
39 >                        (*ep->pf)(strerror(errno));
40                  }
41                  (*ep->pf)("\n");
42          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines