summaryrefslogtreecommitdiff
path: root/zwgc/error.h
diff options
context:
space:
mode:
authorGravatar Marc Horowitz <marc@mit.edu>1989-11-01 20:02:01 +0000
committerGravatar Marc Horowitz <marc@mit.edu>1989-11-01 20:02:01 +0000
commitd13d8a046838ce3d0e2643bb5b49f2ff77d679ca (patch)
tree05737bc11e3461836ce817939b9129ed58545ac7 /zwgc/error.h
parentfd994e4099ad66fb3bf26cd636ca5d5cae72da68 (diff)
Initial revision
Diffstat (limited to 'zwgc/error.h')
-rw-r--r--zwgc/error.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/zwgc/error.h b/zwgc/error.h
new file mode 100644
index 0000000..8bba3a8
--- /dev/null
+++ b/zwgc/error.h
@@ -0,0 +1,43 @@
+#ifndef error_MODULE
+#define error_MODULE
+
+#include <stdio.h>
+
+extern int errno;
+extern int error_code;
+extern void com_err();
+
+#define FATAL_TRAP(function_call, message) \
+ { error_code = (function_call);\
+ if (error_code) {\
+ com_err("zwgc", error_code,\
+ message);\
+ exit(3);\
+ }\
+ }
+
+#define TRAP(function_call, message) \
+ { error_code = (function_call);\
+ if (error_code) {\
+ com_err("zwgc", error_code,\
+ message);\
+ }\
+ }
+
+#define ERROR(a) { fprintf(stderr, "zwgc: "); \
+ fprintf(stderr, a);\
+ fflush(stderr); }
+
+#define ERROR2(a,b) { fprintf(stderr, "zwgc: "); \
+ fprintf(stderr, a, b);\
+ fflush(stderr); }
+
+#define ERROR3(a,b,c) { fprintf(stderr, "zwgc: "); \
+ fprintf(stderr, a, b, c);\
+ fflush(stderr); }
+
+#define ERROR4(a,b,c,d) { fprintf(stderr, "zwgc: "); \
+ fprintf(stderr, a, b, c, d);\
+ fflush(stderr); }
+
+#endif