? typescript 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/22 16:28:30 @@ -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/22 16:28:34 @@ -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/22 16:28:34 @@ -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/22 16:28:34 @@ -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/22 16:28:34 @@ -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/22 16:28:40 @@ -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/22 16:28:40 @@ -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/22 16:28:40 @@ -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/22 16:28:40 @@ -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/22 16:28:43 @@ -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/22 16:28:44 @@ -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/22 16:28:45 @@ -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/22 16:28:55 @@ -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/22 16:28:55 @@ -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/22 16:28:55 @@ -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/22 16:28:56 @@ -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/22 16:28:58 @@ -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/22 16:28:58 @@ -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/22 16:28:59 @@ -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/22 16:28:59 @@ -11,6 +11,10 @@ GNU General Public License for more details. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include /* getenv() */ 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/22 16:29:00 @@ -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/22 16:29:00 @@ -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/22 16:29:01 @@ -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/22 16:29:03 @@ -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/22 16:29:06 @@ -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/22 16:29:06 @@ -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/22 16:29:07 @@ -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/22 16:29:07 @@ -14,6 +14,9 @@ /********************************************************************** Functions for handling the nations. ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include 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/22 16:29:08 @@ -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/22 16:29:12 @@ -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/22 16:29:12 @@ -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/22 16:29:15 @@ -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,75 @@ } else { return M_PRE_FAIL; } +} + +/*************************************************************************** + Look up the given IPv4 host and fill in *sck. Note that the caller + should fill in the port number (sck->sin_port). +***************************************************************************/ +int look_up_host(const char *hostname, struct sockaddr_in *sck) +{ + struct hostent *ph; + + sck->sin_family = AF_INET; + + /* Run the hostname thought inet_addr() / inet_aton() first, in case + we're dealing with a dotted quad. gethostbyname() is supposed to + handle this, but rumour has it that some implementations don't. + We prefer inet_aton() if it is available, since INADDR_NONE is in + fact a legal address... */ + +#ifdef HAVE_INET_ATON + if (inet_aton(hostname, & (sck->sin_addr))) { + return 1; + } +#else + /* I have no idea why this would be necessary, but the old code to + look up hosts included it, so I suppose there is some sort of + portability issue. In any case, they do no harm. GS */ +# ifndef INADDR_NONE +# define INADDR_NONE 0xffffffff +# endif + { + unsigned int addr = (unsigned int) inet_addr(hostname); + + if (addr != INADDR_NONE) { + sck->sin_addr.s_addr = addr; + return 1; + } + } +#endif + ph = gethostbyname(hostname); + if (ph == NULL) { + return 0; + } + + /* RFC 2553 states that gethostbyname() should never return IPv6 + addresses. However, RFC 2133 (which was an earlier draft which + has now been obsoleted by RFC 2553) states that is should return + IPv6 addresses if the RES_USE_INET6 option is set. Since there + are still RFC 2133 systems around (including anthing based on the + current glibc,) we check for that possibility here. + + Additionally, to quote the glibc manual: + + `int h_addrtype' + + This is the host address type; in practice, its value + is always either `AF_INET' or `AF_INET6', with the + latter being used for IPv6 hosts. In principle other + kinds of addresses could be represented in the data + base as well as Internet addresses; if this were + done, you might find a value in this field other than + `AF_INET' or `AF_INET6'. *Note Socket Addresses::. */ + + if (ph->h_addrtype != AF_INET + || ph->h_length != sizeof (struct in_addr)) { /* Doubly paranoid. */ + return 0; + } + + sck->sin_addr = *(struct in_addr *)(ph->h_addr); + 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/22 16:29:16 @@ -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/22 16:29:16 @@ -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/22 16:29:17 @@ -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/22 16:29:17 @@ -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/22 16:29:18 @@ -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.88 diff -u -r1.88 gotohand.c --- gotohand.c 2000/09/17 13:54:39 1.88 +++ gotohand.c 2000/09/22 16:29:24 @@ -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/22 16:29:25 @@ -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/22 16:29:30 @@ -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