Author: cazfi Date: Thu Mar 3 07:27:50 2016 New Revision: 32161 URL: http://svn.gna.org/viewcvs/freeciv?rev=32161&view=rev Log: Made former SOCKET_ZERO_ISNT_STDIN public in freeciv_config.h as FREECIV_SOCKET_ZERO_NOT_STDIN.
See patch #7028 Modified: trunk/configure.ac trunk/gen_headers/freeciv_config.h.in trunk/server/sernet.c trunk/utility/support.c trunk/utility/support.h Modified: trunk/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=32161&r1=32160&r2=32161&view=diff ============================================================================== --- trunk/configure.ac (original) +++ trunk/configure.ac Thu Mar 3 07:27:50 2016 @@ -701,7 +701,7 @@ dnl BeOS-specific settings if test x`$UNAME -s` = xBeOS ; then - AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [BeOS-specific setting]) + AC_DEFINE([FREECIV_SOCKET_ZERO_NOT_STDIN], [1], [BeOS-specific setting]) CFLAGS="$CFLAGS -Wno-multichar" LDFLAGS="$LDFLAGS -x none" if test x$enable_debug = xyes ; then @@ -728,7 +728,7 @@ HOST_PATH_SEPARATOR=";" - AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [Mingw-specific setting - stdin]) + AC_DEFINE([FREECIV_SOCKET_ZERO_NOT_STDIN], [1], [Mingw-specific setting - stdin]) AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Mingw]) AC_DEFINE([WIN32_NATIVE], [1], [Mingw-specific setting - native]) AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support]) Modified: trunk/gen_headers/freeciv_config.h.in URL: http://svn.gna.org/viewcvs/freeciv/trunk/gen_headers/freeciv_config.h.in?rev=32161&r1=32160&r2=32161&view=diff ============================================================================== --- trunk/gen_headers/freeciv_config.h.in (original) +++ trunk/gen_headers/freeciv_config.h.in Thu Mar 3 07:27:50 2016 @@ -104,6 +104,9 @@ /* uses winsock2 */ #undef FREECIV_HAVE_WINSOCK2 +/* socket zero isn't same stdin */ +#undef FREECIV_SOCKET_ZERO_NOT_STDIN + /* Extra debugging support */ #undef FREECIV_DEBUG Modified: trunk/server/sernet.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/sernet.c?rev=32161&r1=32160&r2=32161&view=diff ============================================================================== --- trunk/server/sernet.c (original) +++ trunk/server/sernet.c Thu Mar 3 07:27:50 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -131,7 +131,7 @@ static int server_accept_connection(int sockfd); static void start_processing_request(struct connection *pconn, - int request_id); + int request_id); static void finish_processing_request(struct connection *pconn); static void connection_ping(struct connection *pconn); static void send_ping_times_to_all(void); @@ -144,22 +144,22 @@ /* Avoid compiler warning about defined, but unused function * by defining it only when needed */ #if defined(FREECIV_HAVE_LIBREADLINE) || \ - (!defined(SOCKET_ZERO_ISNT_STDIN) && !defined(FREECIV_HAVE_LIBREADLINE)) + (!defined(FREECIV_SOCKET_ZERO_NOT_STDIN) && !defined(FREECIV_HAVE_LIBREADLINE)) /***************************************************************************** This happens if you type an EOF character with nothing on the current line. *****************************************************************************/ static void handle_stdin_close(void) { - /* Note this function may be called even if SOCKET_ZERO_ISNT_STDIN, so + /* Note this function may be called even if FREECIV_SOCKET_ZERO_NOT_STDIN, so * the preprocessor check has to come inside the function body. But - * perhaps we want to do this even when SOCKET_ZERO_ISNT_STDIN? */ -#ifndef SOCKET_ZERO_ISNT_STDIN + * perhaps we want to do this even when FREECIV_SOCKET_ZERO_NOT_STDIN? */ +#ifndef FREECIV_SOCKET_ZERO_NOT_STDIN log_normal(_("Server cannot read standard input. Ignoring input.")); no_input = TRUE; -#endif /* SOCKET_ZERO_ISNT_STDIN */ -} - -#endif /* FREECIV_HAVE_LIBREADLINE || (!SOCKET_ZERO_ISNT_STDIN && !FREECIV_HAVE_LIBREADLINE) */ +#endif /* FREECIV_SOCKET_ZERO_NOT_STDIN */ +} + +#endif /* FREECIV_HAVE_LIBREADLINE || (!FREECIV_SOCKET_ZERO_NOT_STDIN && !FREECIV_HAVE_LIBREADLINE) */ #ifdef FREECIV_HAVE_LIBREADLINE /****************************************************************************/ @@ -502,8 +502,8 @@ bool excepting; fd_set readfs, writefs, exceptfs; struct timeval tv; -#ifdef SOCKET_ZERO_ISNT_STDIN - char *bufptr; +#ifdef FREECIV_SOCKET_ZERO_NOT_STDIN + char *bufptr; #endif con_prompt_init(); @@ -668,13 +668,13 @@ FC_FD_ZERO(&exceptfs); if (!no_input) { -#ifdef SOCKET_ZERO_ISNT_STDIN +#ifdef FREECIV_SOCKET_ZERO_NOT_STDIN fc_init_console(); -#else /* SOCKET_ZERO_ISNT_STDIN */ +#else /* FREECIV_SOCKET_ZERO_NOT_STDIN */ # if !defined(__VMS) FD_SET(0, &readfs); -# endif /* VMS */ -#endif /* SOCKET_ZERO_ISNT_STDIN */ +# endif /* VMS */ +#endif /* FREECIV_SOCKET_ZERO_NOT_STDIN */ } max_desc = 0; @@ -745,10 +745,10 @@ } } #else /* !__VMS */ -#ifndef SOCKET_ZERO_ISNT_STDIN +#ifndef FREECIV_SOCKET_ZERO_NOT_STDIN really_close_connections(); continue; -#endif /* SOCKET_ZERO_ISNT_STDIN */ +#endif /* FREECIV_SOCKET_ZERO_NOT_STDIN */ #endif /* !__VMS */ } } @@ -788,7 +788,7 @@ connection_close_server(pconn, _("network exception")); } } -#ifdef SOCKET_ZERO_ISNT_STDIN +#ifdef FREECIV_SOCKET_ZERO_NOT_STDIN if (!no_input && (bufptr = fc_read_console())) { char *bufptr_internal = local_to_internal_string_malloc(bufptr); @@ -796,7 +796,7 @@ handle_stdin_input(NULL, bufptr_internal); free(bufptr_internal); } -#else /* !SOCKET_ZERO_ISNT_STDIN */ +#else /* !FREECIV_SOCKET_ZERO_NOT_STDIN */ if (!no_input && FD_ISSET(0, &readfs)) { /* input from server operator */ #ifdef FREECIV_HAVE_LIBREADLINE rl_callback_read_char(); @@ -844,7 +844,7 @@ free(buffer); #endif /* !FREECIV_HAVE_LIBREADLINE */ } else -#endif /* !SOCKET_ZERO_ISNT_STDIN */ +#endif /* !FREECIV_SOCKET_ZERO_NOT_STDIN */ { /* input from a player */ for (i = 0; i < MAX_NUM_CONNECTIONS; i++) { Modified: trunk/utility/support.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/support.c?rev=32161&r1=32160&r2=32161&view=diff ============================================================================== --- trunk/utility/support.c (original) +++ trunk/utility/support.c Thu Mar 3 07:27:50 2016 @@ -11,7 +11,7 @@ GNU General Public License for more details. ***********************************************************************/ -/********************************************************************** +/********************************************************************** This module contains replacements for functions which are not available on all platforms. Where the functions are available natively, these are (mostly) just wrappers. @@ -20,7 +20,7 @@ alternative would be to use the "standard" function name, and provide the implementation only if required. However the method here has some advantages: - + - We can provide definite prototypes in support.h, rather than worrying about whether a system prototype exists, and if so where, and whether it is correct. (Note that whether or not configure @@ -935,9 +935,9 @@ #endif } -#ifdef SOCKET_ZERO_ISNT_STDIN +#ifdef FREECIV_SOCKET_ZERO_NOT_STDIN /********************************************************************** - Support for console I/O in case SOCKET_ZERO_ISNT_STDIN. + Support for console I/O in case FREECIV_SOCKET_ZERO_NOT_STDIN. ***********************************************************************/ #define CONSOLE_BUF_SIZE 100 @@ -963,7 +963,7 @@ #endif /* WIN32_NATIVE */ /********************************************************************** - Initialize console I/O in case SOCKET_ZERO_ISNT_STDIN. + Initialize console I/O in case FREECIV_SOCKET_ZERO_NOT_STDIN. ***********************************************************************/ void fc_init_console(void) { @@ -989,7 +989,7 @@ } /********************************************************************** - Read a line from console I/O in case SOCKET_ZERO_ISNT_STDIN. + Read a line from console I/O in case FREECIV_SOCKET_ZERO_NOT_STDIN. This returns a pointer to a statically allocated buffer. Subsequent calls to fc_read_console() or fc_init_console() will @@ -1031,7 +1031,7 @@ #endif /* WIN32_NATIVE */ } -#endif /* SOCKET_ZERO_ISNT_STDIN */ +#endif /* FREECIV_SOCKET_ZERO_NOT_STDIN */ /********************************************************************** Returns TRUE iff the file is a regular file or a link to a regular Modified: trunk/utility/support.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/support.h?rev=32161&r1=32160&r2=32161&view=diff ============================================================================== --- trunk/utility/support.h (original) +++ trunk/utility/support.h Thu Mar 3 07:27:50 2016 @@ -18,7 +18,7 @@ extern "C" { #endif /* __cplusplus */ -/********************************************************************** +/*********************************************************************** Replacements for functions which are not available on all platforms. Where the functions are available natively, these are just wrappers. See also mem.h, netintf.h, rand.h, and see support.c for more comments. @@ -157,11 +157,11 @@ int fc_gethostname(char *buf, size_t len); -#ifdef SOCKET_ZERO_ISNT_STDIN -/* Support for console I/O in case SOCKET_ZERO_ISNT_STDIN. */ +#ifdef FREECIV_SOCKET_ZERO_NOT_STDIN +/* Support for console I/O in case FREECIV_SOCKET_ZERO_NOT_STDIN. */ void fc_init_console(void); char *fc_read_console(void); -#endif +#endif /* FREECIV_SOCKET_ZERO_NOT_STDIN */ bool is_reg_file_for_access(const char *name, bool write_access); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits