ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/error.c
Revision: 2.3
Committed: Wed May 28 17:23:31 1997 UTC (26 years, 11 months ago) by gregl
Content type: text/plain
Branch: MAIN
Changes since 2.2: +2 -0 lines
Log Message:
fix for Alpha Linux

File Contents

# User Rev Content
1 greg 1.1 /* Copyright (c) 1991 Regents of the University of California */
2    
3     #ifndef lint
4     static char SCCSid[] = "$SunId$ LBL";
5     #endif
6    
7     /*
8     * error.c - standard error reporting function
9     */
10    
11     #include "standard.h"
12    
13 gregl 2.3 #ifndef linux
14 greg 1.1 extern char *sys_errlist[]; /* system error list */
15     extern int sys_nerr; /* number of system errors */
16 gregl 2.3 #endif
17 greg 1.1
18 greg 2.2 char errmsg[512]; /* global error message buffer */
19 greg 1.1
20    
21     error(etype, emsg) /* report error, quit if necessary */
22     int etype;
23     char *emsg;
24     {
25     switch (etype) {
26     case WARNING:
27     wputs("warning - ");
28     wputs(emsg);
29     wputs("\n");
30     return;
31     case COMMAND:
32     cputs(emsg);
33     cputs("\n");
34     return;
35     case USER:
36     eputs("fatal - ");
37     eputs(emsg);
38     eputs("\n");
39     quit(1);
40     case INTERNAL:
41     eputs("internal - ");
42     eputs(emsg);
43     eputs("\n");
44     quit(1);
45     case SYSTEM:
46     eputs("system - ");
47     eputs(emsg);
48     if (errno > 0) {
49     eputs(": ");
50     if (errno <= sys_nerr)
51     eputs(sys_errlist[errno]);
52     else
53     eputs("Unknown error");
54     }
55     eputs("\n");
56     quit(2);
57     case CONSISTENCY:
58     eputs("consistency - ");
59     eputs(emsg);
60     eputs("\n");
61     abort();
62     }
63     }