* 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 */
#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
struct timeval answer_delay;
int i_nbanswer;
char i_answer;
- fd_set fd;
+ fd_set fds;
unsigned int i_rc;
char * psz_channel_server;
*/
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 )
{