diff gdb_remote.c @ 1949:5a76a7373823

Get WIP net play code compiling on Windows and cleanup some unistd.h includes
author Michael Pavone <pavone@retrodev.com>
date Thu, 30 Apr 2020 23:15:50 -0700
parents ba7231d2411c
children 495569c1dc61
line wrap: on
line diff
--- a/gdb_remote.c	Wed Apr 29 23:53:39 2020 -0700
+++ b/gdb_remote.c	Thu Apr 30 23:15:50 2020 -0700
@@ -18,13 +18,13 @@
 #define GDB_OUT_FD STDOUT_FILENO
 #define GDB_READ read
 #define GDB_WRITE write
+#include <unistd.h>
 #endif
 
 #include "gdb_remote.h"
 #include "68kinst.h"
 #include "debug.h"
 #include "util.h"
-#include <unistd.h>
 #include <fcntl.h>
 #include <stddef.h>
 #include <stdlib.h>
@@ -558,21 +558,13 @@
 	}
 }
 
-#ifdef _WIN32
-void gdb_cleanup(void)
-{
-	WSACleanup();
-}
-WSADATA wsa_data;
-#endif
-
 void gdb_remote_init(void)
 {
 	buf = malloc(INITIAL_BUFFER_SIZE);
 	curbuf = NULL;
 	bufsize = INITIAL_BUFFER_SIZE;
 #ifdef _WIN32
-	WSAStartup(MAKEWORD(2,2), &wsa_data);
+	socket_init();
 
 	struct addrinfo request, *result;
 	memset(&request, 0, sizeof(request));
@@ -596,7 +588,7 @@
 	if (gdb_sock < 0) {
 		fatal_error("accept returned an error while listening on GDB remote debugging socket");
 	}
-	closesocket(listen_sock);
+	socket_close(listen_sock);
 #else
 	disable_stdout_messages();
 #endif