#if (defined(WINDOWS) || defined(MSDOS))
+# ifdef __DJGPP__
+# include <unistd.h>
+# include <sys/stat.h>
+# define _setmode setmode
+# define _O_TEXT O_TEXT
+# define _O_BINARY O_BINARY
+# endif /* __DJGPP__ */
+
# ifndef S_IFDIR
# define S_IFDIR _S_IFDIR
# endif
/*************/
#ifdef USE_SOCKETS
-# if defined(WINDOWS) || defined(MSDOS)
+# if (defined(WINDOWS) || defined(MSDOS)) && !defined(__DJGPP__)
/* windows world */
# ifdef OPENSSL_NO_SOCK
# define SSLeay_Write(a,b,c) write((a),(b),(c))
# define SHUTDOWN(fd) { shutdown((fd),0); closesocket((fd)); }
# define SHUTDOWN2(fd) { shutdown((fd),2); closesocket((fd)); }
+# ifndef INVALID_SOCKET
# define INVALID_SOCKET (-1)
+# endif /* INVALID_SOCKET */
# endif
#endif
# define strcasecmp stricmp
#endif
+/* vxworks */
+#if defined(OPENSSL_SYS_VXWORKS)
+#include <ioLib.h>
+#include <tickLib.h>
+#include <sysLib.h>
+
+#define TTY_STRUCT int
+
+#define sleep(a) taskDelay((a) * sysClkRateGet())
+#if defined(ioctlsocket)
+#undef ioctlsocket
+#endif
+#define ioctlsocket(a,b,c) ioctl((a),(b),*(c))
+
+#include <vxWorks.h>
+#include <sockLib.h>
+#include <taskLib.h>
+
+#define getpid taskIdSelf
+
+/* NOTE: these are implemented by helpers in database app!
+ * if the database is not linked, we need to implement them
+ * elswhere */
+struct hostent *gethostbyname(const char *name);
+struct hostent *gethostbyaddr(const char *addr, int length, int type);
+struct servent *getservbyname(const char *name, const char *proto);
+
+#endif
+/* end vxworks */
+
#ifdef __cplusplus
}
#endif