cnping

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

commit 558b2b721c23813bf6dd9801e73c166a810178cc
parent 32eb4a25a97ab38cfc3565e0fbc8908ce609f961
Author: Niklas Mischkulnig <niklas@mischkulnig.de>
Date:   Sun,  2 Oct 2016 10:24:29 +0200

Cleanup

Diffstat:
Mcnping-mousey.c | 4----
Mcnping.c | 4----
Mping.c | 36+++++++++---------------------------
3 files changed, 9 insertions(+), 35 deletions(-)

diff --git a/cnping-mousey.c b/cnping-mousey.c @@ -9,11 +9,7 @@ #include <windows.h> #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 @@ -9,11 +9,7 @@ #include <windows.h> #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 @@ -17,7 +17,7 @@ */ /*****************************************************************************/ -/*** myping.c ***/ +/*** ping.c ***/ /*** ***/ /*** Use the ICMP protocol to request "echo" from destination. ***/ /*****************************************************************************/ @@ -42,30 +42,20 @@ void bzero(void *location,__LONG32 count); #include <winsock2.h> #include <ws2tcpip.h> #include <stdint.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; -}; #else #include <sys/socket.h> #include <resolv.h> #include <netdb.h> - #ifdef __APPLE__ -#include <netinet/in_systm.h> +#ifndef SOL_IP +#define SOL_IP IPPROTO_IP +#endif +#endif #include <netinet/ip.h> +#include <netinet/ip_icmp.h> +#endif +#include <stdlib.h> +#if defined WIN32 || defined __APPLE__ struct icmphdr { uint8_t type; uint8_t code; @@ -82,15 +72,7 @@ struct icmphdr { } frag; } un; }; -#ifndef SOL_IP -#define SOL_IP IPPROTO_IP #endif -#endif - -#include <netinet/in.h> -#include <netinet/ip_icmp.h> -#endif -#include <stdlib.h> float pingperiod; int precise_ping;