1 /* syslog portability layer for husky, written 2001 by tobias ernst 2 * $Id$ 3 */ 4 #ifndef __HUSKYLIB_SYSLOGP_H 5 # define __HUSKYLIB_SYSLOGP_H 6 7 # include "compiler.h" 8 9 /* ===== part 1: include system syslog header or provide our own prototypes */ 10 11 # if defined (__UNIX__) && !defined(__BEOS__) 12 13 # ifdef HAS_SYSLOG_H 14 # include <syslog.h> 15 # ifndef HAVE_SYSLOG 16 # define HAVE_SYSLOG /* indicate that this platform can do syslog */ 17 # endif 18 # else 19 # ifdef HAS_SYS_SYSLOG_H 20 # include <sys/syslog.h> 21 # ifndef HAVE_SYSLOG 22 # define HAVE_SYSLOG /* indicate that this platform can do syslog */ 23 # endif 24 # endif /* HAS_SYS_SYSLOG_H */ 25 # endif /* HAS_SYSLOG_H */ 26 27 # endif 28 29 /* we may add support for os/2 here in the 30 future */ 31 32 /* ===== part 2: write some portability layer code for broken unix systems */ 33 34 # ifdef HAVE_SYSLOG 35 36 /* ----- unix systems that have syslog, but not facilitynames */ 37 38 # if defined(__sun__) || defined(__CYGWIN__) || defined(_AIX) 39 40 typedef struct _code 41 { 42 char *c_name; 43 int c_val; 44 } CODE; 45 46 /* we only define ones which we think are present on all crazy unix systems 47 and useful for fido apps. i.e. we leave out obscurities like "security" etc 48 */ 49 CODE facilitynames[] = { 50 {"daemon", LOG_DAEMON,}, 51 {"mail", LOG_MAIL,}, 52 {"news", LOG_NEWS,}, 53 {"syslog", LOG_SYSLOG}, 54 {"user", LOG_USER,}, 55 {"uucp", LOG_UUCP,}, 56 {"local0", LOG_LOCAL0,}, 57 {"local1", LOG_LOCAL1,}, 58 {"local2", LOG_LOCAL2,}, 59 {"local3", LOG_LOCAL3,}, 60 {"local4", LOG_LOCAL4,}, 61 {"local5", LOG_LOCAL5,}, 62 {"local6", LOG_LOCAL6,}, 63 {"local7", LOG_LOCAL7,} 64 { NULL, -1 } 65 }; 66 # endif 67 68 # ifndef LOG_PERROR 69 # define LOG_PERROR 0 70 # endif 71 # endif/* HAVE_SYSLOG */ 72 73 #endif /* not defined __HUSKYLIB_SYSLOGP_H */ 74