sources/main.cpp

branch
protocol5
changeset 84
3bd32eec3d57
parent 81
a18aaf460648
child 88
08ccaf26cffd
--- a/sources/main.cpp	Sun May 17 22:07:48 2015 +0300
+++ b/sources/main.cpp	Wed May 27 21:15:52 2015 +0300
@@ -28,9 +28,15 @@
 	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#include "main.h"
+
+#ifndef _WIN32
+# include <sys/select.h>
+#else
+# include <winsock2.h>
+#endif
+
 #include <time.h>
-#include <sys/select.h>
-#include "main.h"
 #include "network/rconsession.h"
 #include "huffman.h"
 #include "interface.h"
@@ -40,6 +46,19 @@
 FUNCTION
 main (int argc, char* argv[]) -> int
 {
+#ifdef _WIN32
+	FreeConsole();
+
+	WSADATA wsaData;
+	int result = WSAStartup (MAKEWORD (2, 2), &wsaData);
+
+	if (result != 0)
+	{
+		fprintf (stderr, "WSAStartup failed: %d\n", result);
+		return 1;
+	}
+#endif
+	
 	HUFFMAN_Construct();
 
 	if (argc != 1 and argc != 3)

mercurial