From 31c69b6ca1b91e7fd9fd8e14082fd2584c5f538c Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sun, 24 May 2020 16:48:22 +0200 Subject: first public release Signed-off-by: Toni Uhlig --- source/tools/ircmsg.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 source/tools/ircmsg.c (limited to 'source/tools/ircmsg.c') 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; +} -- cgit v1.2.3