summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/CMakeLists.txt6
-rw-r--r--tools/iproxy.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 08ea714..64d0d0e 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -2,6 +2,10 @@ include_directories (${CMAKE_SOURCE_DIR}/libusbmuxd)
link_directories (${CMAKE_BINARY_DIR}/libusbmuxd)
add_executable(iproxy iproxy.c)
-target_link_libraries(iproxy libusbmuxd pthread)
+if(WIN32)
+ target_link_libraries(iproxy libusbmuxd pthread ws2_32)
+else()
+ target_link_libraries(iproxy libusbmuxd pthread)
+endif()
install(TARGETS iproxy RUNTIME DESTINATION bin)
diff --git a/tools/iproxy.c b/tools/iproxy.c
index 707724a..1855c67 100644
--- a/tools/iproxy.c
+++ b/tools/iproxy.c
@@ -30,11 +30,17 @@ TODO: improve code...
#include <string.h>
#include <fcntl.h>
#include <stddef.h>
-#include <sys/socket.h>
-#include <sys/un.h>
#include <unistd.h>
#include <errno.h>
+#ifdef WIN32
+#include <windows.h>
+#include <winsock2.h>
+typedef unsigned int socklen_t;
+#else
+#include <sys/socket.h>
+#include <sys/un.h>
#include <arpa/inet.h>
+#endif
#include <pthread.h>
#include "sock_stuff.h"
#include "usbmuxd.h"
@@ -98,7 +104,7 @@ void *run_ctos_loop(void *arg)
int recv_len;
int sent;
char buffer[131072];
- pthread_t stoc = 0;
+ pthread_t stoc;
printf("%s: fd = %d\n", __func__, cdata->fd);