]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/zwgc/error.h
finalize -3
[1ts-debian.git] / zephyr / zwgc / error.h
1 /* This file is part of the Project Athena Zephyr Notification System.
2  * It is one of the source files comprising zwgc, the Zephyr WindowGram
3  * client.
4  *
5  *      Created by:     Marc Horowitz <marc@athena.mit.edu>
6  *
7  *      $Id$
8  *
9  *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
10  *      For copying and distribution information, see the file
11  *      "mit-copyright.h".
12  */
13
14
15 #include <zephyr/mit-copyright.h>
16
17 #ifndef error_MODULE
18 #define error_MODULE
19
20 #include <stdio.h>
21 #include <errno.h>
22 #include <com_err.h>
23
24 extern int error_code;
25
26 #define  FATAL_TRAP(function_call, message) \
27                                            { error_code = (function_call);\
28                                             if (error_code) {\
29                                                 com_err("zwgc", error_code,\
30                                                         message);\
31                                                 exit(3);\
32                                             }\
33                                            }
34
35 #define  TRAP(function_call, message) \
36                                           { error_code = (function_call);\
37                                             if (error_code) {\
38                                                 com_err("zwgc", error_code,\
39                                                         message);\
40                                             }\
41                                            }
42
43 #define  ERROR(a)                { fprintf(stderr, "zwgc: "); \
44                                    fprintf(stderr, a);\
45                                    fflush(stderr); }
46
47 #define  ERROR2(a,b)             { fprintf(stderr, "zwgc: "); \
48                                    fprintf(stderr, a, b);\
49                                    fflush(stderr); }
50
51 #define  ERROR3(a,b,c)           { fprintf(stderr, "zwgc: "); \
52                                    fprintf(stderr, a, b, c);\
53                                    fflush(stderr); }
54
55 #define  ERROR4(a,b,c,d)         { fprintf(stderr, "zwgc: "); \
56                                    fprintf(stderr, a, b, c, d);\
57                                    fflush(stderr); }
58
59 #endif