From a1c9cc6e7f067e92eaa831e087f5b9c9f43cf34a Mon Sep 17 00:00:00 2001 From: "Joseph C. Lehner" Date: Fri, 5 Feb 2016 20:23:16 +0200 Subject: [PATCH] Initialize winsock in main.c --- ethsock.h | 12 ------------ main.c | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 13 deletions(-) delete mode 100644 ethsock.h diff --git a/ethsock.h b/ethsock.h deleted file mode 100644 index 16e3864..0000000 --- a/ethsock.h +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -struct ethsock; - -struct ethsock *ethsock_create(const char *intf, uint16_t protocol); -int ethsock_close(struct ethsock *sock); -int ethsock_send(struct ethsock *sock, void *buf, size_t len); -ssize_t ethsock_recv(struct ethsock *sock, void *buf, size_t len); -int ethsock_set_timeout(struct ethsock *sock, unsigned msec); -uint8_t *ethsock_get_hwaddr(struct ethsock *sock); -int ethsock_list_all(void); diff --git a/main.c b/main.c index 06158f5..2dfc167 100644 --- a/main.c +++ b/main.c @@ -76,6 +76,15 @@ int main(int argc, char **argv) .port = 69, .force_root = 1 }; +#ifdef NMRPFLASH_WINDOWS + WSADATA wsa; + + val = WSAStartup(MAKEWORD(2, 2), &wsa); + if (val != 0) { + win_perror2("WSAStartup", val); + return 1; + } +#endif opterr = 0; @@ -145,5 +154,9 @@ int main(int argc, char **argv) } #endif - return nmrp_do(&args); + val = nmrp_do(&args); +#ifdef NMRPFLASH_WINDOWS + WSACleanup(); +#endif + return val; } -- 2.25.1