1: /* 2: ** error.h Error handling macros 3: ** 4: ** This program is in the public domain and may be used freely by anyone 5: ** who wants to. 6: ** 7: ** Last update: 19 Aug 1992 8: ** 9: ** Please send bug fixes/bug reports to: Peter Eriksson <pen@lysator.liu.se> 10: */ 11: 12: #ifndef __ERROR_H__ 13: #define __ERROR_H__ 14: 15: #include <syslog.h> 16: 17: #define ERROR(fmt) \ 18: ((syslog_flag ? (syslog(LOG_ERR, fmt),0) : 0), \ 19: (debug_flag ? (fprintf(stderr, "%d , %d : ERROR : X-DBG : ", \ 20: lport, fport), \ 21: fprintf(stderr, fmt), perror(": "), 0) : \ 22: (printf("%d , %d : ERROR : UNKNOWN-ERROR\r\n", lport, fport), 0)), \ 23: fflush(stdout), fflush(stderr), exit(1), 0) 24: 25: 26: #define ERROR1(fmt,v1) \ 27: ((syslog_flag ? (syslog(LOG_ERR, fmt, v1),0) : 0), \ 28: (debug_flag ? (fprintf(stderr, "%d , %d : ERROR : X-DBG : ", \ 29: lport, fport), \ 30: fprintf(stderr, fmt, v1), perror(": "), 0) : \ 31: (printf("%d , %d : ERROR : UNKNOWN-ERROR\r\n", lport, fport), 0)), \ 32: fflush(stdout), fflush(stderr), exit(1), 0) 33: 34: #define ERROR2(fmt,v1,v2) \ 35: ((syslog_flag ? (syslog(LOG_ERR, fmt, v1, v2),0) : 0), \ 36: (debug_flag ? (fprintf(stderr, "%d , %d : ERROR : X-DBG : ", \ 37: lport, fport), \ 38: fprintf(stderr, fmt, v1, v2), perror(": "), 0) : \ 39: (printf("%d , %d : ERROR : UNKNOWN-ERROR\r\n", lport, fport), 0)), \ 40: fflush(stdout), fflush(stderr), exit(1), 0) 41: 42: #endif