WinCE patches
[openssl.git] / crypto / bio / bss_log.c
index 1edf16a76fd807ae922b8360ee419e795158cb0f..1eb678cac0950bc98b213aca09a5c82f7224ab67 100644 (file)
 #include <stdio.h>
 #include <errno.h>
 
-#if defined(WIN32)
+#include "cryptlib.h"
+
+#if defined(OPENSSL_SYS_WINCE)
+#elif defined(OPENSSL_SYS_WIN32)
 #  include <process.h>
-#elif defined(VMS) || defined(__VMS)
+#elif defined(OPENSSL_SYS_VMS)
 #  include <opcdef.h>
 #  include <descrip.h>
 #  include <lib$routines.h>
 #  include <starlet.h>
 #elif defined(__ultrix)
 #  include <sys/syslog.h>
-#elif !defined(MSDOS) /* Unix */
+#elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG)
 #  include <syslog.h>
 #endif
 
-#include "cryptlib.h"
 #include <openssl/buffer.h>
 #include <openssl/err.h>
 
 #ifndef NO_SYSLOG
 
-#if defined(WIN32)
+#if defined(OPENSSL_SYS_WIN32)
 #define LOG_EMERG      0
 #define LOG_ALERT      1
 #define LOG_CRIT       2
@@ -96,7 +98,7 @@
 #define LOG_DEBUG      7
 
 #define LOG_DAEMON     (3<<3)
-#elif defined(VMS)
+#elif defined(OPENSSL_SYS_VMS)
 /* On VMS, we don't really care about these, but we need them to compile */
 #define LOG_EMERG      0
 #define LOG_ALERT      1
@@ -118,7 +120,7 @@ static int MS_CALLBACK slg_free(BIO *data);
 static void xopenlog(BIO* bp, char* name, int level);
 static void xsyslog(BIO* bp, int priority, const char* string);
 static void xcloselog(BIO* bp);
-#ifdef WIN32
+#ifdef OPENSSL_SYS_WIN32
 LONG   (WINAPI *go_for_advapi)()       = RegOpenKeyEx;
 HANDLE (WINAPI *register_event_source)()       = NULL;
 BOOL   (WINAPI *deregister_event_source)()     = NULL;
@@ -241,7 +243,7 @@ static int MS_CALLBACK slg_puts(BIO *bp, const char *str)
        return(ret);
        }
 
-#if defined(WIN32)
+#if defined(OPENSSL_SYS_WIN32)
 
 static void xopenlog(BIO* bp, char* name, int level)
 {
@@ -273,7 +275,7 @@ static void xsyslog(BIO *bp, int priority, const char *string)
        LPCSTR lpszStrings[2];
        WORD evtype= EVENTLOG_ERROR_TYPE;
        int pid = _getpid();
-       char pidbuf[20];
+       char pidbuf[DECIMAL_SIZE(pid)+4];
 
        switch (priority)
                {
@@ -313,7 +315,7 @@ static void xcloselog(BIO* bp)
        bp->ptr= NULL;
 }
 
-#elif defined(VMS)
+#elif defined(OPENSSL_SYS_VMS)
 
 static int VMS_OPC_target = LOG_DAEMON;
 
@@ -372,11 +374,15 @@ static void xcloselog(BIO* bp)
 {
 }
 
-#else /* Unix */
+#else /* Unix/Watt32 */
 
 static void xopenlog(BIO* bp, char* name, int level)
 {
+#ifdef WATT32   /* djgpp/DOS */
+       openlog(name, LOG_PID|LOG_CONS|LOG_NDELAY, level);
+#else
        openlog(name, LOG_PID|LOG_CONS, level);
+#endif
 }
 
 static void xsyslog(BIO *bp, int priority, const char *string)