summaryrefslogtreecommitdiff
path: root/win/inspircd_win32wrapper.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-08 03:48:43 -0400
committerAdam <Adam@anope.org>2011-04-10 17:54:20 -0400
commitb56565eac2d7207c88c53054cb1096519ec7fba9 (patch)
treecd0f10a47dd002157553d96e2ef91ea5d620eadc /win/inspircd_win32wrapper.cpp
parentf8588b112fe6ef1095e40fcd64f85e670d96bc92 (diff)
Fixed Windows build on VS 2010
Diffstat (limited to 'win/inspircd_win32wrapper.cpp')
-rw-r--r--win/inspircd_win32wrapper.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp
index d82c90a61..88ea338c6 100644
--- a/win/inspircd_win32wrapper.cpp
+++ b/win/inspircd_win32wrapper.cpp
@@ -238,7 +238,7 @@ int printf_c(const char * format, ...)
int optind = 1;
char optarg[514];
-int getopt_long_only(int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind)
+int getopt_long(int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind)
{
// burlex todo: handle the shortops, at the moment it only works with longopts.
@@ -556,7 +556,7 @@ int clock_gettime(int clock, struct timespec * tv)
DWORD mstime = timeGetTime();
tv->tv_sec = time(NULL);
- tv->tv_usec = (mstime - (tv->tv_sec * 1000)) * 1000000;
+ tv->tv_nsec = (mstime - (tv->tv_sec * 1000)) * 1000000;
return 0;
}
@@ -696,3 +696,49 @@ int getcpu()
return cpu;
}
+
+int random()
+{
+ return rand();
+}
+
+void srandom(unsigned int seed)
+{
+ srand(seed);
+}
+
+int gettimeofday(timeval *tv, void *)
+{
+ SYSTEMTIME st;
+ GetSystemTime(&st);
+
+ tv->tv_sec = ServerInstance->Time();
+ tv->tv_usec = st.wMilliseconds;
+
+ return 0;
+}
+
+/* World's largest hack to make m_spanningtree work */
+#include "../src/modules/m_spanningtree/link.h"
+static void unused_Function()
+{
+ reference<Link> unused_Link;
+ reference<Autoconnect> unused_Autoconnect;
+
+ if (unused_Link)
+ unused_Link->Port = -1;
+ if (unused_Autoconnect)
+ unused_Autoconnect->NextConnectTime = -1;
+
+ Autoconnect *a = unused_Autoconnect;
+ Link *l = unused_Link;
+
+ unused_Link = reference<Link>(unused_Link);
+ unused_Autoconnect = reference<Autoconnect>(unused_Autoconnect);
+
+ unused_Link = reference<Link>(l);
+ unused_Autoconnect = reference<Autoconnect>(a);
+
+ delete unused_Link;
+ delete unused_Autoconnect;
+}