diff options
author | bonmas14 <bonmas14@gmail.com> | 2025-09-28 17:53:03 +0000 |
---|---|---|
committer | bonmas14 <bonmas14@gmail.com> | 2025-09-28 17:53:03 +0000 |
commit | 30751aece04ba8954513bbb7aca996244e6fa684 (patch) | |
tree | c40dfac95dd3c0766656324c45465f0375061b5d /src/disgrace.c | |
parent | 3ad95773ae4f963435003c260278177f1e22577e (diff) | |
download | ungrateful-30751aece04ba8954513bbb7aca996244e6fa684.tar.gz ungrateful-30751aece04ba8954513bbb7aca996244e6fa684.zip |
changes
Diffstat (limited to 'src/disgrace.c')
-rw-r--r-- | src/disgrace.c | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/src/disgrace.c b/src/disgrace.c index b5e5666..424ca5b 100644 --- a/src/disgrace.c +++ b/src/disgrace.c @@ -1,53 +1,35 @@ #include "disgrace.h" +enum { + D_TYPE_TCP, + D_TYPE_UDP +}; + #if defined(OS_WINDOWS) #include <winsock2.h> +#include <ws2tcpip.h> #include <windows.h> #if defined(MSVC_COMPILER) #pragma comment(lib, "Ws2_32.lib") #endif -enum { - D_TYPE_TCP, - D_TYPE_UDP -}; - -typedef struct DHandle { - u64 type; -} DHandle; - -b32 d_init(void) { - WSADATA data; - int error; - - if (WSAStartup(MAKEWORD(2, 2), &data)) { - error = WSAGetLastError(); - cyn_log_write_cstring(CYN_LOG_ERROR, (u8*) "WsaStartup failed, code: %d.", (s64)error); - return false; - } - - return true; -} - - -#include "d_tcp_win.c" -#include "d_udp_win.c" +#include "d_win.c" #elif defined(OS_LINUX) -b32 d_init(void) { - return true; -} +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> +#include <netinet/in.h> +#include <arpa/inet.h> -// #error "Linux todo" -// #include "d_udp_linux.c" +#include "d_linux.c" #else #error "unknown platform" - #endif |