Index: configure =================================================================== RCS file: /home/freeciv/CVS/freeciv/configure,v retrieving revision 1.131 diff -u -r1.131 configure --- configure 2000/09/21 04:13:32 1.131 +++ configure 2000/09/24 18:37:37 @@ -6845,9 +6845,9 @@ fi -for ac_func in fdopen gethostname getpwuid gettimeofday select \ - snooze strerror strcasecmp strncasecmp strlcat \ - strlcpy strstr usleep vsnprintf +for ac_func in fdopen gethostname getpwuid gettimeofday inet_aton \ + select snooze strerror strcasecmp strncasecmp \ + strlcat strlcpy strstr usleep vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:6854: checking for $ac_func" >&5 Index: configure.in =================================================================== RCS file: /home/freeciv/CVS/freeciv/configure.in,v retrieving revision 1.138 diff -u -r1.138 configure.in --- configure.in 2000/09/21 04:13:33 1.138 +++ configure.in 2000/09/24 18:37:37 @@ -440,9 +440,9 @@ AC_TYPE_SIGNAL AC_FUNC_STRCOLL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(fdopen gethostname getpwuid gettimeofday select \ - snooze strerror strcasecmp strncasecmp strlcat \ - strlcpy strstr usleep vsnprintf) +AC_CHECK_FUNCS(fdopen gethostname getpwuid gettimeofday inet_aton \ + select snooze strerror strcasecmp strncasecmp \ + strlcat strlcpy strstr usleep vsnprintf) dnl We would AC_CHECK_FUNCS for socket as well, except it is complicated dnl by the fact that the -lsocket is in X_EXTRA_LIBS and/or SERVER_LIBS, Index: ai/advattitude.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advattitude.c,v retrieving revision 1.3 diff -u -r1.3 advattitude.c --- advattitude.c 2000/03/04 03:55:26 1.3 +++ advattitude.c 2000/09/24 18:37:39 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "city.h" #include "tech.h" Index: ai/advdomestic.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v retrieving revision 1.60 diff -u -r1.60 advdomestic.c --- advdomestic.c 2000/08/31 13:32:37 1.60 +++ advdomestic.c 2000/09/24 18:37:41 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include Index: ai/advforeign.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advforeign.c,v retrieving revision 1.3 diff -u -r1.3 advforeign.c --- advforeign.c 2000/03/04 03:55:26 1.3 +++ advforeign.c 2000/09/24 18:37:41 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "city.h" #include "tech.h" Index: ai/advisland.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advisland.c,v retrieving revision 1.3 diff -u -r1.3 advisland.c --- advisland.c 2000/03/04 03:55:26 1.3 +++ advisland.c 2000/09/24 18:37:41 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "city.h" #include "tech.h" Index: ai/advleader.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advleader.c,v retrieving revision 1.3 diff -u -r1.3 advleader.c --- advleader.c 1999/09/15 09:09:20 1.3 +++ advleader.c 2000/09/24 18:37:41 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "player.h" #include "aitools.h" Index: ai/advmilitary.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v retrieving revision 1.64 diff -u -r1.64 advmilitary.c --- advmilitary.c 2000/08/13 10:46:17 1.64 +++ advmilitary.c 2000/09/24 18:37:46 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include Index: ai/advscience.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advscience.c,v retrieving revision 1.3 diff -u -r1.3 advscience.c --- advscience.c 2000/03/04 03:55:26 1.3 +++ advscience.c 2000/09/24 18:37:46 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "city.h" #include "tech.h" Index: ai/advspace.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advspace.c,v retrieving revision 1.4 diff -u -r1.4 advspace.c --- advspace.c 1999/09/05 02:46:59 1.4 +++ advspace.c 2000/09/24 18:37:47 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include Index: ai/advtrade.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advtrade.c,v retrieving revision 1.3 diff -u -r1.3 advtrade.c --- advtrade.c 2000/03/04 03:55:26 1.3 +++ advtrade.c 2000/09/24 18:37:47 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "city.h" #include "tech.h" Index: ai/aihand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aihand.c,v retrieving revision 1.48 diff -u -r1.48 aihand.c --- aihand.c 2000/08/31 13:32:37 1.48 +++ aihand.c 2000/09/24 18:37:49 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: ai/aitech.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aitech.c,v retrieving revision 1.25 diff -u -r1.25 aitech.c --- aitech.c 2000/09/04 02:10:41 1.25 +++ aitech.c 2000/09/24 18:37:50 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: ai/aitools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v retrieving revision 1.31 diff -u -r1.31 aitools.c --- aitools.c 2000/08/31 13:32:38 1.31 +++ aitools.c 2000/09/24 18:37:54 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: ai/aiunit.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v retrieving revision 1.126 diff -u -r1.126 aiunit.c --- aiunit.c 2000/09/01 06:21:52 1.126 +++ aiunit.c 2000/09/24 18:38:00 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: client/clinet.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/clinet.c,v retrieving revision 1.32 diff -u -r1.32 clinet.c --- clinet.c 2000/09/18 20:36:13 1.32 +++ clinet.c 2000/09/24 18:38:04 @@ -75,10 +75,6 @@ #include "clinet.h" -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - struct connection aconnection; extern char metaserver[]; @@ -120,35 +116,22 @@ int connect_to_server(char *name, char *hostname, int port, char *errbuf, int n_errbuf) { - /* use name to find TCPIP address of server */ + /* use name to find TCP/IP address of server */ struct sockaddr_in src; - struct hostent *ph; - long address; struct packet_req_join_game req; - if(port==0) - port=DEFAULT_SOCK_PORT; - - if(!hostname) + if (port == 0) { + port = DEFAULT_SOCK_PORT; + } + + if (!hostname) { hostname="localhost"; - - if(isdigit((size_t)*hostname)) { - if((address = inet_addr(hostname)) == INADDR_NONE) { - mystrlcpy(errbuf, _("Invalid hostname"), n_errbuf); - return -1; - } - src.sin_addr.s_addr = address; - src.sin_family = AF_INET; } - else if ((ph = gethostbyname(hostname)) == NULL) { - mystrlcpy(errbuf, _("Failed looking up host"), n_errbuf); + + if (!look_up_host(hostname, &src)) { + my_snprintf(errbuf, n_errbuf, _("Failed to look up host '%s'"), hostname); return -1; } - else { - src.sin_family = ph->h_addrtype; - memcpy((char *) &src.sin_addr, ph->h_addr, ph->h_length); - } - src.sin_port = htons(port); #ifdef HAVE_SIGPIPE @@ -242,7 +225,6 @@ { struct server_list *server_list; struct sockaddr_in addr; - struct hostent *ph; int s; FILE *f; char *proxy_url; @@ -300,12 +282,9 @@ urlpath = s; } - if ((ph = gethostbyname(server)) == NULL) { - mystrlcpy(errbuf, _("Failed looking up host"), n_errbuf); + if (!look_up_host(server, &addr)) { + my_snprintf(errbuf, n_errbuf, _("Failed to look up host '%s'."), server); return NULL; - } else { - addr.sin_family = ph->h_addrtype; - memcpy((char *) &addr.sin_addr, ph->h_addr, ph->h_length); } addr.sin_port = htons(port); Index: client/gui-gtk/colors.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/colors.c,v retrieving revision 1.4 diff -u -r1.4 colors.c --- colors.c 1999/07/14 11:23:06 1.4 +++ colors.c 2000/09/24 18:38:04 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include Index: client/gui-gtk/gtkpixcomm.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gtkpixcomm.c,v retrieving revision 1.3 diff -u -r1.3 gtkpixcomm.c --- gtkpixcomm.c 2000/05/09 18:33:58 1.3 +++ gtkpixcomm.c 2000/09/24 18:38:06 @@ -32,6 +32,9 @@ * This widget will have a built-in X window for capturing "click" events, so * that we no longer need to insert it inside a GtkEventBox. -vasc */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "gtkpixcomm.h" Index: client/gui-xaw/actions.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/actions.c,v retrieving revision 1.7 diff -u -r1.7 actions.c --- actions.c 2000/09/08 01:53:27 1.7 +++ actions.c 2000/09/24 18:38:08 @@ -11,6 +11,9 @@ GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "game.h" Index: common/astring.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/astring.c,v retrieving revision 1.2 diff -u -r1.2 astring.c --- astring.c 1999/08/08 03:57:40 1.2 +++ astring.c 2000/09/24 18:38:10 @@ -38,6 +38,10 @@ ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "mem.h" @@ -154,5 +158,3 @@ } ath_init(ath, size); } - - Index: common/capability.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/capability.c,v retrieving revision 1.4 diff -u -r1.4 capability.c --- capability.c 1999/06/10 12:15:58 1.4 +++ capability.c 2000/09/24 18:38:10 @@ -11,6 +11,10 @@ GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include Index: common/capstr.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v retrieving revision 1.73 diff -u -r1.73 capstr.c --- capstr.c 2000/09/06 21:41:15 1.73 +++ capstr.c 2000/09/24 18:38:11 @@ -11,6 +11,10 @@ GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include /* getenv() */ Index: common/create_lsend.pl =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/create_lsend.pl,v retrieving revision 1.1 diff -u -r1.1 create_lsend.pl --- create_lsend.pl 2000/08/02 14:12:34 1.1 +++ create_lsend.pl 2000/09/24 18:38:12 @@ -76,6 +76,8 @@ print OUT_C "\n/$stars\n$gen\n$stars/\n\n"; } +print OUT_C "\#ifdef HAVE_CONFIG_H\n\#include\"config.h\"\n\#endif\n\n"; + # packets.h should include packet_l.h print OUT_C "\#include \"packets.h\"\n\n"; Index: common/diptreaty.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/diptreaty.c,v retrieving revision 1.5 diff -u -r1.5 diptreaty.c --- diptreaty.c 2000/05/27 22:06:19 1.5 +++ diptreaty.c 2000/09/24 18:38:12 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include Index: common/genlist.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/genlist.c,v retrieving revision 1.5 diff -u -r1.5 genlist.c --- genlist.c 2000/01/26 01:03:26 1.5 +++ genlist.c 2000/09/24 18:38:13 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "mem.h" Index: common/government.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/government.c,v retrieving revision 1.21 diff -u -r1.21 government.c --- government.c 2000/09/11 06:40:37 1.21 +++ government.c 2000/09/24 18:38:13 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include Index: common/hash.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/hash.c,v retrieving revision 1.7 diff -u -r1.7 hash.c --- hash.c 2000/08/06 11:47:09 1.7 +++ hash.c 2000/09/24 18:38:15 @@ -89,6 +89,9 @@ ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: common/idex.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/idex.c,v retrieving revision 1.2 diff -u -r1.2 idex.c --- idex.c 2000/08/14 12:42:04 1.2 +++ idex.c 2000/09/24 18:38:19 @@ -27,6 +27,9 @@ On probable errors, print LOG_ERROR messages and persevere, unless IDEX_DIE set. ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include Index: common/improvement.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/improvement.c,v retrieving revision 1.3 diff -u -r1.3 improvement.c --- improvement.c 2000/09/11 06:40:37 1.3 +++ improvement.c 2000/09/24 18:38:20 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include Index: common/inputfile.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/inputfile.c,v retrieving revision 1.10 diff -u -r1.10 inputfile.c --- inputfile.c 2000/08/14 12:42:04 1.10 +++ inputfile.c 2000/09/24 18:38:20 @@ -62,6 +62,9 @@ escaped doublequotes etc back to normal. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: common/nation.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/nation.c,v retrieving revision 1.9 diff -u -r1.9 nation.c --- nation.c 2000/08/14 12:42:04 1.9 +++ nation.c 2000/09/24 18:38:21 @@ -14,6 +14,9 @@ /********************************************************************** Functions for handling the nations. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: common/packets_lsend.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/packets_lsend.c,v retrieving revision 1.3 diff -u -r1.3 packets_lsend.c --- packets_lsend.c 2000/08/27 06:57:23 1.3 +++ packets_lsend.c 2000/09/24 18:38:21 @@ -15,6 +15,10 @@ This file was auto-generated, by create_lsend.pl (must be run manually) **********************************************************************/ +#ifdef HAVE_CONFIG_H +#include"config.h" +#endif + #include "packets.h" void lsend_packet_diplomacy_info(struct conn_list *dest, enum packet_type pt, Index: common/rand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/rand.c,v retrieving revision 1.3 diff -u -r1.3 rand.c --- rand.c 2000/08/14 12:42:05 1.3 +++ rand.c 2000/09/24 18:38:22 @@ -30,6 +30,9 @@ Original author for this code: Cedric Tefft Modified to use rand_state struct by David Pfitzner *************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include Index: common/registry.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/registry.c,v retrieving revision 1.32 diff -u -r1.32 registry.c --- registry.c 2000/08/14 12:42:05 1.32 +++ registry.c 2000/09/24 18:38:25 @@ -143,6 +143,9 @@ - The number of entries is fixed when the hash table is built. - Now uses hash.c **************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: common/sbuffer.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/sbuffer.c,v retrieving revision 1.2 diff -u -r1.2 sbuffer.c --- sbuffer.c 1999/08/08 04:13:37 1.2 +++ sbuffer.c 2000/09/24 18:38:26 @@ -29,6 +29,9 @@ Uses fc_malloc() etc for allocations, so malloc failures are handled there; makes liberal use of assert(). ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: common/shared.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/shared.c,v retrieving revision 1.61 diff -u -r1.61 shared.c --- shared.c 2000/09/22 07:24:24 1.61 +++ shared.c 2000/09/24 18:38:29 @@ -21,6 +21,12 @@ #include #include +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif #ifdef HAVE_UNISTD_H #include #endif @@ -839,6 +845,38 @@ } else { return M_PRE_FAIL; } +} + +/*************************************************************************** + Look up the given host and fill in *sock. Note that the caller + should fill in the port number (sck->sin_port). +***************************************************************************/ +int look_up_host(const char *hostname, struct sockaddr_in *sock) +{ + struct hostent *hp; + + sock->sin_family = AF_INET; + +#ifdef HAVE_INET_ATON + if (inet_aton(hostname, &sock->sin_addr)) { + return 1; + } +#else +# ifndef INADDR_NONE +# define INADDR_NONE 0xffffffff +# endif + + if ((sock->sin_addr.s_addr = inet_addr(hostname)) != INADDR_NONE) { + return 1; + } +#endif + hp = gethostbyname(hostname); + if (hp == NULL || hp->h_addrtype != AF_INET) { + return 0; + } + + memcpy(&sock->sin_addr, hp->h_addr, hp->h_length); + return 1; } /*************************************************************************** Index: common/shared.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v retrieving revision 1.85 diff -u -r1.85 shared.h --- shared.h 2000/09/22 07:24:24 1.85 +++ shared.h 2000/09/24 18:38:29 @@ -15,6 +15,10 @@ #include /* size_t */ +#ifdef HAVE_NETINET_IN_H +#include +#endif + #include "attribute.h" /* Note: the capability string is now in capstr.c --dwp */ @@ -119,6 +123,8 @@ m_pre_strncmp_fn_t cmp_fn, const char *prefix, int *ind_result); + +int look_up_host(const char *hostname, struct sockaddr_in *sck); char *freeciv_motto(void); Index: common/spaceship.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/spaceship.c,v retrieving revision 1.1 diff -u -r1.1 spaceship.c --- spaceship.c 1999/02/16 10:57:07 1.1 +++ spaceship.c 2000/09/24 18:38:33 @@ -10,6 +10,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "spaceship.h" Index: common/tech.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/tech.c,v retrieving revision 1.25 diff -u -r1.25 tech.c --- tech.c 2000/09/11 06:40:38 1.25 +++ tech.c 2000/09/24 18:38:33 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include Index: common/worklist.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/worklist.c,v retrieving revision 1.5 diff -u -r1.5 worklist.c --- worklist.c 2000/08/31 13:32:46 1.5 +++ worklist.c 2000/09/24 18:38:33 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include Index: server/autoattack.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/autoattack.c,v retrieving revision 1.20 diff -u -r1.20 autoattack.c --- autoattack.c 2000/08/22 08:48:32 1.20 +++ autoattack.c 2000/09/24 18:38:37 @@ -25,6 +25,9 @@ (in work by other persons) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include Index: server/gotohand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/gotohand.c,v retrieving revision 1.89 diff -u -r1.89 gotohand.c --- gotohand.c 2000/09/23 19:01:41 1.89 +++ gotohand.c 2000/09/24 18:38:43 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include Index: server/meta.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/meta.c,v retrieving revision 1.36 diff -u -r1.36 meta.c --- meta.c 2000/08/22 08:55:02 1.36 +++ meta.c 2000/09/24 18:38:44 @@ -74,10 +74,6 @@ #include "meta.h" -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - int server_is_open=0; #ifdef GENERATING_MAC /* mac network globals */ @@ -209,7 +205,6 @@ InetHostInfo hinfo; #else struct sockaddr_in cli_addr, serv_addr; - struct hostent *hp; #endif /* @@ -228,16 +223,10 @@ bad=true; } #else - memset(&serv_addr, 0, sizeof(serv_addr)); - serv_addr.sin_addr.s_addr = inet_addr(servername); - if ((bad = (serv_addr.sin_addr.s_addr == INADDR_NONE))) { - if (!(bad = ((hp = gethostbyname(servername)) == NULL))) { - memcpy(&serv_addr.sin_addr.s_addr, hp->h_addr, hp->h_length); - } - } - serv_addr.sin_family = AF_INET; - serv_addr.sin_port = htons(srvarg.metaserver_port); + bad = ! look_up_host(servername, &serv_addr); + serv_addr.sin_port = htons(srvarg.metaserver_port); #endif + if (bad) { freelog(LOG_ERROR, _("Metaserver: bad address: [%s]."), servername); metaserver_failed(); Index: server/settlers.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v retrieving revision 1.84 diff -u -r1.84 settlers.c --- settlers.c 2000/08/25 13:54:28 1.84 +++ settlers.c 2000/09/24 18:38:51 @@ -10,6 +10,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include