ThomasHabets / arping

ARP Ping
http://www.habets.pp.se/synscan/programs.php
GNU General Public License v2.0
403 stars 63 forks source link

Make arping compile on Windows again #10

Open ThomasHabets opened 12 years ago

ThomasHabets commented 12 years ago

I (Thomas) will probably not be doing this. I'm adding this issue in case someone else wants to take it on.

It shouldn't be that much work. Arping 2.05 compiled on Windows (not by me and I don't know how, but I have the .exe so I know it worked) and there haven't been that many changes since then.

ThomasHabets commented 8 years ago

Backup of an old patch:

--- ../../download/arping-2.06/arping-2/arping.c    2007-09-13 12:43:38.000000000 -0400
+++ arping.c    2007-09-15 15:02:36.031250000 -0400
@@ -49,14 +49,20 @@
 #endif

 #ifdef WIN32
-#include <win32/libnet.h>
+#include <libnet.h>
+#ifndef HAVE_GETGID
+#define getgid() 0
+#endif
+#ifndef HAVE_GETUID
+#define getuid() 0
+#endif
 #endif
 #include <pcap.h>

 #if defined(WIN32)
 #define HAVE_ESIZE_TYPES 1
-#include "win32.h"
-#include "win32/getopt.h"
+//#include "win32.h"
+#include <getopt.h>
 #endif

 #if !defined(linux)
@@ -762,7 +768,7 @@
               tv.tv_sec--;
               tv.tv_usec += 1000000;
           }
-          usleep(10);
+          Sleep(10);
           if (tv.tv_sec < 0) {
               done=1;
           }
@@ -844,7 +850,7 @@
               break;
           default: {
 #else
-          usleep(10);
+          Sleep(10);
           {{
 #endif
               int ret;
@@ -852,8 +858,8 @@
                             func,
                             NULL))) {
                   // rest, so we don't take 100% CPU... mostly
-                  // hmm... does usleep() exist everywhere?
-                  usleep(10);
+                  // hmm... does Sleep() exist everywhere?
+                  Sleep(10);
 #ifndef HAVE_WEIRD_BSD
                   // weird is normal on bsd :)
                   if (verbose) {