cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

commit 32eb4a25a97ab38cfc3565e0fbc8908ce609f961
parent 45945d12a3fdd62a8f14340fb41443a3368c8ce7
Author: CNLohr <charles@cnlohr.com>
Date:   Sat,  1 Oct 2016 12:46:21 -0400

Merge pull request #10 from mischnic/master

Changes to compile on Mac
Diffstat:
MMakefile | 6+++---
Mcnping-mousey.c | 4++++
Mcnping.c | 4++++
Mping.c | 25+++++++++++++++++++++++++
4 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,8 +1,8 @@ all : cnping searchnet cnping-mousey -CFLAGS:=$(CFLAGS) -g -Os +CFLAGS:=$(CFLAGS) -g -Os -I/opt/X11/include CXXFLAGS:=$(CFLAGS) -LDFLAGS:=-g +LDFLAGS:=-g -L/opt/X11/lib/ MINGW32:=/usr/bin/i686-w64-mingw32- @@ -24,5 +24,5 @@ linuxinstall : cnping sudo chmod +s /usr/local/bin/cnping clean : - rm -rf *.o *~ cnping cnping.exe + rm -rf *.o *~ cnping cnping.exe cnping-mousey searchnet diff --git a/cnping-mousey.c b/cnping-mousey.c @@ -10,6 +10,10 @@ #else #include <sys/socket.h> #include <netinet/in.h> +#ifdef __APPLE__ +#include <netinet/in_systm.h> +#include <netinet/ip.h> +#endif #include <netinet/ip_icmp.h> #include <arpa/inet.h> #include <sys/select.h> diff --git a/cnping.c b/cnping.c @@ -10,6 +10,10 @@ #else #include <sys/socket.h> #include <netinet/in.h> +#ifdef __APPLE__ +#include <netinet/in_systm.h> +#include <netinet/ip.h> +#endif #include <netinet/ip_icmp.h> #include <arpa/inet.h> #include <sys/select.h> diff --git a/ping.c b/ping.c @@ -62,6 +62,31 @@ struct icmphdr { #include <sys/socket.h> #include <resolv.h> #include <netdb.h> + +#ifdef __APPLE__ +#include <netinet/in_systm.h> +#include <netinet/ip.h> +struct icmphdr { + uint8_t type; + uint8_t code; + uint16_t checksum; + union { + struct { + uint16_t id; + uint16_t sequence; + } echo; + uint32_t gateway; + struct { + uint16_t __unused; + uint16_t mtu; + } frag; + } un; +}; +#ifndef SOL_IP +#define SOL_IP IPPROTO_IP +#endif +#endif + #include <netinet/in.h> #include <netinet/ip_icmp.h> #endif