win32 support for fping #43

Open
wants to merge 5 commits into
from

Conversation

Projects
None yet
4 participants

No description provided.

@liudongmiao liudongmiao commented on the diff Mar 13, 2013

src/fping.c
@@ -390,6 +533,12 @@ int main( int argc, char **argv )
#endif
HOST_ENTRY *cursor;
+#ifdef _WIN32
@liudongmiao

liudongmiao Mar 13, 2013

microsoft particular code for socket.

@liudongmiao liudongmiao commented on the diff Mar 13, 2013

src/fping.c
@@ -645,8 +794,13 @@ int main( int argc, char **argv )
case 'S':
#ifndef IPV6
+#ifndef _WIN32
@liudongmiao

liudongmiao Mar 13, 2013

inet_pton is not for windows xp

@liudongmiao liudongmiao commented on the diff Mar 13, 2013

src/fping.c
@@ -1028,8 +1182,12 @@ void add_cidr(char *addr)
struct in_addr in_addr_tmp;
char buffer[20];
in_addr_tmp.s_addr = htonl(net_addr);
+#ifndef _WIN32
@liudongmiao

liudongmiao Mar 13, 2013

inet_ntop is not for windows xp.

@liudongmiao liudongmiao commented on the diff Mar 13, 2013

src/getopt.c
@@ -0,0 +1,567 @@
@liudongmiao

liudongmiao Mar 13, 2013

copy from android, bionic's libc/unistd/getopt_long.c

@schweikert schweikert commented on the diff May 21, 2013

src/fping.c
@@ -37,6 +37,147 @@
/* if compiling for Windows, use this separate set
(too difficult to ifdef all the autoconf defines) */
+#ifdef _WIN32
+#define WIN32
+#undef UNICODE
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <stdio.h>
@schweikert

schweikert May 21, 2013

Owner

While I really appreciate the effort, this really doesn't seem right. Win32 support should be added in the autoconf scripts. It's more work, but it's the right way.

@liudongmiao

liudongmiao May 22, 2013

Er, er, just as the original comment:
if compiling for Windows, use this separate set
(too difficult to ifdef all the autoconf defines)

For windows, or Android (yes, its linux), there is no necessary to run configure.
As for windows or android, usually there is no autoconf, no way to run configure.
There is NMakefile, windows users can just run `nmake', which is part of Microsoft Visual Studio.
In that days I even wanted to provided a Microsoft Visual Studio project file, however, I didn't.

And when I check the original fping, there is linux.h.
So it should be better to split them from fping.c to win32.h, just as:
liudongmiao/fping-win32@9d226a5

However, currently autoconf/configure is used to generate version number too.
So there should somewhere to define version number if we dont want to autoconf.
// actually, there is predefine version number in autoconf/configure too.

Did this ever end up going anywhere?

After schweikert's idea, i just use another project, fping-win32, http://github.com/liudongmiao/fping-win32, based on the original source code, only add win32 support. However, I'm not using win32.

On 12/11/2013 午前 10:50, Liu DongMiao wrote:

After schweikert's idea, i just use another project, fping-win32,
http://github.com/liudongmiao/fping-win32
https://github.com/liudongmiao/fping-win32, based on the original
source code, only add win32 support. However, I'm not using win32.


Reply to this email directly or view it on GitHub
#43 (comment).

Hello,

Yeah, I went ahead and built that instead. Works fine, thank you.

just found the fping-win32 project, compiled using nmake from visual studio. Thank you for this, all the other win32 fping.exe programs I've found don't have the easy to parse output like this and the linux version do. Saved me a lot of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment