Nmap Development mailing list archives

Re: [Patch] nsock/tests/addrset.c


From: Gisle Vanem <gvanem () broadpark no>
Date: Wed, 07 Aug 2013 17:39:51 +0200

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().

--- .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/


Current thread: