]> git.sesse.net Git - vlc/blobdiff - src/misc/netutils.c
* DirectX plugin by Gildas Bazin <gbazin@netcourrier.com>.
[vlc] / src / misc / netutils.c
index cfa3214c469b2464bdf6892b2d39494599c4db28..b1bdcc18fb0d6dbf671a65b0db1e63ef998f26b7 100644 (file)
@@ -2,7 +2,7 @@
  * netutils.c: various network functions
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: netutils.c,v 1.35 2001/05/30 23:02:04 stef Exp $
+ * $Id: netutils.c,v 1.37 2001/06/02 01:09:03 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Benoit Steiner <benny@via.ecp.fr>
 #include <stdlib.h>                             /* free(), realloc(), atoi() */
 #include <errno.h>                                                /* errno() */
 #include <string.h>                                              /* memset() */
+
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>                                         /* gethostname() */
+#elif defined( _MSC_VER ) && defined( _WIN32 )
+#include <io.h>
+#endif
+
+#if !defined( _MSC_VER )
 #include <sys/time.h>                                        /* gettimeofday */
+#endif
 
-#ifndef WIN32
+#if !defined( WIN32 )
 #include <netdb.h>                                        /* gethostbyname() */
 #include <netinet/in.h>                               /* BSD: struct in_addr */
 #include <sys/socket.h>                              /* BSD: struct sockaddr */
@@ -49,7 +57,7 @@
 #include <sys/ioctl.h>                                            /* ioctl() */
 #endif
 
-#ifdef WIN32                            /* tools to get the MAC adress from  */
+#if defined( WIN32 )                    /* tools to get the MAC adress from  */
 #include <windows.h>                    /* the interface under Windows      */
 #include <stdio.h>
 #endif
@@ -254,7 +262,7 @@ int network_ChannelJoin( int i_channel )
     struct timeval      answer_delay;
     int                 i_nbanswer;
     char                i_answer;
-    fd_set              fd;
+    fd_set              fds;
     unsigned int        i_rc;
     char *              psz_channel_server;
 
@@ -361,9 +369,9 @@ int network_ChannelJoin( int i_channel )
      */
     answer_delay.tv_sec  = 5;
     answer_delay.tv_usec = 0;
-    FD_ZERO( &fd );
-    FD_SET( i_socket, &fd );
-    i_nbanswer = select( i_socket + 1, &fd, NULL, NULL, &answer_delay );
+    FD_ZERO( &fds );
+    FD_SET( i_socket, &fds );
+    i_nbanswer = select( i_socket + 1, &fds, NULL, NULL, &answer_delay );
 
     switch( i_nbanswer )
     {