Nmap Development mailing list archives
Re: [Patch] nsock/tests/addrset.c
From: Jacek Wielemborek <wielemborekj1 () gmail com>
Date: Wed, 7 Aug 2013 17:43:15 +0200
2013/8/7 Gisle Vanem <gvanem () broadpark no>:
A typo; the subject should be ncat/tests/addrset.c. Duh me! "Gisle Vanem" <gvanem () broadpark no> wrote:+#ifdef WIN32 +static void win_init (void) +{ + WSADATA data; + if (WSAStartup(MAKEWORD(2,2), &data) != 0) + fatal ("failed to start winsock.\n");Another problem with MSVC. Since many of the ncat sources uses C99-features (like data after code), I was forced to compile most of ncat as C++. This brings up the problem with calling fatal() with no prototype. Which .h-file should we use in this case? There's fatal() protypes all over the place. So lets just revert to printf() + exit().
I believe that fatal() is declared in nsock/src/error.h - Ncat depends on Nbase and Nsock.
--- .SVN-Latest/ncat/test/addrset.c 2013-04-25 08:06:41 +0000
+++ ncat/test/addrset.c 2013-08-07 15:34:57 +0000
@@ -22,6 +22,17 @@
#include "ncat_core.h"
+#ifdef WIN32
+static void win_init (void)
+{
+ WSADATA data;
+ if (WSAStartup(MAKEWORD(2,2), &data) != 0) {
+ printf ("failed to start winsock.\n");
+ exit(1);
+ }
+}
+#endif
+
static int resolve_name(const char *name, struct addrinfo **result)
{
struct addrinfo hints = { 0 };
@@ -38,6 +49,10 @@
char line[1024];
int i;
+#ifdef WIN32
+ win_init();
+#endif
+
addrset_init(&set);
options_init();
----------
--gv
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/
_______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [Patch] nsock/tests/addrset.c Gisle Vanem (Aug 07)
- Re: [Patch] nsock/tests/addrset.c Gisle Vanem (Aug 07)
- Re: [Patch] nsock/tests/addrset.c Jacek Wielemborek (Aug 07)
- Re: [Patch] nsock/tests/addrset.c Gisle Vanem (Aug 07)
