Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] (PR#8484) minor cleanups to connectdlg_common
Home

[Freeciv-Dev] (PR#8484) minor cleanups to connectdlg_common

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8484) minor cleanups to connectdlg_common
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 10 Apr 2004 22:47:49 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8484 >

server_pid and server_process should be static since they're not 
referenced in connectdlg_common.h.

server_process however _is_ referenced outside of connectldg_common.c, 
although it shouldn't be.  This is a job for Andreas.  I suspect that 
right now although the win32 client works the gtk2/win32 client does not.

Also instead of a check for __VMS we should do a real configure check. 
This patch does that too.  Checking for fork may not be entirely 
sufficient, since other functions (execvp, etc.) are also used - but at 
least it's a step in the right direction.

For documentation on AC_FUNC_FORK see
http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_chapter/autoconf_5.html#SEC46

I tend to think things will still break badly on obscure old systems.  A 
system that doesn't have fork probably won't have wait, kill, or pid_t 
either.  So compilation will already break.  The only good solutions are 
to either agressively use lots of configure checks, or to wait for such 
problems to arise and then fix them.  The second is much easier.

jason

Index: configure.ac
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.ac,v
retrieving revision 1.59
diff -u -r1.59 configure.ac
--- configure.ac        11 Apr 2004 05:23:31 -0000      1.59
+++ configure.ac        11 Apr 2004 05:46:47 -0000
@@ -538,6 +538,7 @@
 
 dnl Checks for library functions.
 AC_TYPE_SIGNAL
+AC_FUNC_FORK
 AC_FUNC_STRCOLL
 AC_FUNC_VPRINTF
 AC_FUNC_VSNPRINTF
Index: configure.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.in,v
retrieving revision 1.234
diff -u -r1.234 configure.in
--- configure.in        11 Apr 2004 05:23:31 -0000      1.234
+++ configure.in        11 Apr 2004 05:46:47 -0000
@@ -522,6 +522,7 @@
 
 dnl Checks for library functions.
 AC_TYPE_SIGNAL
+AC_FUNC_FORK
 AC_FUNC_STRCOLL
 AC_FUNC_VPRINTF
 AC_FUNC_VSNPRINTF
Index: client/connectdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.c,v
retrieving revision 1.3
diff -u -r1.3 connectdlg_common.c
--- client/connectdlg_common.c  11 Apr 2004 05:23:31 -0000      1.3
+++ client/connectdlg_common.c  11 Apr 2004 05:46:48 -0000
@@ -60,9 +60,10 @@
 #define NUMBER_OF_TRIES 500
   
 #ifdef WIN32_NATIVE
+/* FIXME: this is referenced directly in gui-win32/connectdlg.c. */
 HANDLE server_process = INVALID_HANDLE_VALUE;
 #else
-pid_t server_pid = - 1;
+static pid_t server_pid = - 1;
 #endif
 
 char player_name[MAX_LEN_NAME];
@@ -141,7 +142,7 @@
 *****************************************************************/ 
 bool client_start_server(void)
 {
-#if !defined(__VMS) && !defined(WIN32)
+#ifdef HAVE_WORKING_FORK
   int i = 0;
   int nargs = 4; /* base number of args */
   char **argv = NULL;
@@ -261,7 +262,7 @@
   }
 
   return TRUE;
-#else /*VMS or Win32*/
+#else /* Can't do much without fork(). */
   return FALSE;
 #endif
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8484) minor cleanups to connectdlg_common, Jason Short <=