[Freeciv-Dev] (PR#8479) Compile fix for win32 (ext. conndlg)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8479 >
This is a simple compile fix for the win32 client.
BTW: Why we are including network headers in both netintf.h and netintf.c?
I don't think that is necessary.
Greetings
Andreas Kemnade
Index: connectdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.c,v
retrieving revision 1.1
diff -u -r1.1 connectdlg_common.c
--- connectdlg_common.c 10 Apr 2004 03:47:48 -0000 1.1
+++ connectdlg_common.c 10 Apr 2004 11:25:30 -0000
@@ -34,7 +34,13 @@
#endif
/* FIXME: need to use AC_HEADER_SYS_WAIT */
+#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
+
+#ifdef HAVE_WINSOCK
+#include <winsock.h>
+#endif
#include "fcintl.h"
#include "log.h"
@@ -55,9 +61,12 @@
#define WAIT_BETWEEN_TRIES 100000 /* usecs */
#define NUMBER_OF_TRIES 500
-/* FIXME: this will need to change for WIN32 */
+#ifdef WIN32_NATIVE
+HANDLE server_process = INVALID_HANDLE_VALUE;
+#else
pid_t server_pid = - 1;
-
+#endif
+
char player_name[MAX_LEN_NAME];
char *current_filename = NULL;
@@ -101,7 +110,11 @@
**************************************************************************/
bool is_server_running()
{
+#ifdef WIN32_NATIVE
+ return (server_process != INVALID_HANDLE_VALUE);
+#else
return (server_pid > 0);
+#endif
}
/**************************************************************************
@@ -110,9 +123,15 @@
void client_kill_server()
{
if (is_server_running()) {
+#ifdef WIN32_NATIVE
+ TerminateProcess(server_process, 0);
+ CloseHandle(server_process);
+ server_process = INVALID_HANDLE_VALUE;
+#else
kill(server_pid, SIGTERM);
waitpid(server_pid, NULL, WUNTRACED);
server_pid = - 1;
+#endif
}
}
- [Freeciv-Dev] (PR#8479) Compile fix for win32 (ext. conndlg),
Andreas Kemnade <=
|
|