Fix to build better with DJGPP.
[openssl.git] / crypto / bio / b_sock.c
index 741ed27de6e49667cccd6196a01b76d01dcb3f2c..a7da2581014275ce32421a11dd3ce0ddb2ee3732 100644 (file)
@@ -72,9 +72,9 @@
 #endif
 
 #ifdef SO_MAXCONN
-#define MAX_LISTEN  SOMAXCONN
-#elif defined(SO_MAXCONN)
 #define MAX_LISTEN  SO_MAXCONN
+#elif defined(SOMAXCONN)
+#define MAX_LISTEN  SOMAXCONN
 #else
 #define MAX_LISTEN  32
 #endif
@@ -83,6 +83,7 @@
 static int wsa_init_done=0;
 #endif
 
+#if 0
 static unsigned long BIO_ghbn_hits=0L;
 static unsigned long BIO_ghbn_miss=0L;
 
@@ -93,10 +94,13 @@ static struct ghbn_cache_st
        struct hostent *ent;
        unsigned long order;
        } ghbn_cache[GHBN_NUM];
+#endif
 
 static int get_ip(const char *str,unsigned char *ip);
+#if 0
 static void ghbn_free(struct hostent *a);
 static struct hostent *ghbn_dup(struct hostent *a);
+#endif
 int BIO_get_host_ip(const char *str, unsigned char *ip)
        {
        int i;
@@ -228,6 +232,7 @@ int BIO_sock_error(int sock)
                return(j);
        }
 
+#if 0
 long BIO_ghbn_ctrl(int cmd, int iarg, char *parg)
        {
        int i;
@@ -265,7 +270,9 @@ long BIO_ghbn_ctrl(int cmd, int iarg, char *parg)
                }
        return(1);
        }
+#endif
 
+#if 0
 static struct hostent *ghbn_dup(struct hostent *a)
        {
        struct hostent *ret;
@@ -343,6 +350,8 @@ static void ghbn_free(struct hostent *a)
        OPENSSL_free(a);
        }
 
+#endif
+
 struct hostent *BIO_gethostbyname(const char *name)
        {
 #if 1
@@ -458,6 +467,12 @@ int BIO_sock_init(void)
                        }
                }
 #endif /* OPENSSL_SYS_WINDOWS */
+#ifdef WATT32
+       extern int _watt_do_exit;
+       _watt_do_exit = 0;    /* don't make sock_init() call exit() */
+       if (sock_init())
+               return (-1);
+#endif
        return(1);
        }
 
@@ -479,7 +494,11 @@ int BIO_socket_ioctl(int fd, long type, unsigned long *arg)
        {
        int i;
 
+#ifdef __DJGPP__
+       i=ioctlsocket(fd,type,(char *)arg);
+#else
        i=ioctlsocket(fd,type,arg);
+#endif /* __DJGPP__ */
        if (i < 0)
                SYSerr(SYS_F_IOCTLSOCKET,get_last_socket_error());
        return(i);