sources/main.cpp

changeset 81
a18aaf460648
parent 76
6de6d9a64ebd
child 88
08ccaf26cffd
--- a/sources/main.cpp	Fri May 15 21:43:21 2015 +0300
+++ b/sources/main.cpp	Tue May 26 11:41:58 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