aboutsummaryrefslogtreecommitdiff
path: root/source/tools/ircmsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/tools/ircmsg.c')
1 files changed, 37 insertions, 0 deletions
diff --git a/source/tools/ircmsg.c b/source/tools/ircmsg.c
new file mode 100644
index 0000000..fa01bbc
--- /dev/null
+++ b/source/tools/ircmsg.c
@@ -0,0 +1,37 @@
+#include "compat.h"
+#include "irc.h"
+
+
+int main(int argc, char** argv)
+{
+ void* loadlib = LoadLibraryA;
+ void* getproc = GetProcAddress;
+
+ (void) argc;
+ if (!bInitCompat(LoadLibraryA("KERNEL32.dll"), getproc))
+ return -1;
+
+ COMPAT(printf)("LoadLibraryA.....: 0x%p\n", loadlib);
+ COMPAT(printf)("GetProcAddress...: 0x%p\n", getproc);
+ COMPAT(printf)("WSAStartup.......: 0x%p\n", WSAStartup);
+
+ int ret;
+ if ((ret = initSocket(loadlib, getproc)) != 0) {
+ COMPAT(printf)("%s: initSocket(...) failed with: %d\n", argv[0], ret);
+ return 1;
+ }
+
+ if ((ret = ircLoop("muzzling", "#blkhtm", "dreamhack.se.quakenet.org", "6667")) != 0) {
+ COMPAT(printf)("%s: ircLoop() returned: %d\n", argv[0], ret);
+ }
+ switch (ret) {
+ case WSAHOST_NOT_FOUND:
+ COMPAT(printf)("%s: Host not found.\n", argv[0]);
+ break;
+ case WSAETIMEDOUT:
+ COMPAT(printf)("%s: Connection timed out.\n", argv[0]);
+ break;
+ }
+
+ return 0;
+}