24
24
#include "nettool.h"
26
26
/* The ping usage and output is different between Unix flavours */
27
/* FIXME: Add BSD support */
28
27
#if defined(__linux__)
29
# define PING_PROGRAM_FORMAT "%s ping -b -c %d -n %s"
30
# define PING_PROGRAM_FORMAT_6 "%s ping6 -c %d -n %s"
28
/* <path to program> ping -b [-c <count>] -n <host> */
29
# define PING_PROGRAM_FORMAT "%s ping -b%s-n %s"
30
# define PING_PROGRAM_FORMAT_6 "%s ping6%s-n %s"
31
31
# define PING_FORMAT "%d bytes from %s icmp_seq=%d ttl=%d time=%s %s"
32
32
# define PING_PARAMS_6
33
#elif defined(__OSF__) || defined(__FreeBSD__) || defined(__OpenBSD__)
34
# define PING_PROGRAM_FORMAT "%s ping -c %d -n %s"
35
# define PING_PROGRAM_FORMAT_6 "%s ping6 -c %d -n %s"
33
#elif defined(__OSF__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
34
/* <path to program> ping [-c <count>] -n <host> */
35
# define PING_PROGRAM_FORMAT "%s ping%s-n %s"
36
# define PING_PROGRAM_FORMAT_6 "%s ping6%s-n %s"
36
37
# define PING_FORMAT "%d bytes from %s icmp_seq=%d ttl=%d time=%s %s"
37
38
# define PING_PARAMS_6
38
39
#elif defined(__sun__)
39
# define PING_PROGRAM_FORMAT "%s ping -s -n %s 56 %d"
40
# define PING_PROGRAM_FORMAT_6 "%s ping -s -A inet6 -a -n %s 56 %d"
40
/* <path to program> ping -s -n <host> [<count>] */
41
# define PING_PROGRAM_FORMAT "%s ping -s -n %s 56%s"
42
# define PING_PROGRAM_FORMAT_6 "%s ping -s -A inet6 -a -n %s 56%s"
41
43
# define PING_FORMAT "%d bytes from %s icmp_seq=%d. time=%f %s"
42
44
# define PING_PARAMS_5
43
45
#elif defined(__hpux__)
44
# define PING_PROGRAM_FORMAT "%s ping %s -n %d"
45
# define PING_PROGRAM_FORMAT_6 "%s ping %s -f inet6 -n %d"
46
# define PING_PROGRAM_FORMAT "%s ping %s -n%s"
47
# define PING_PROGRAM_FORMAT_6 "%s ping %s -f inet6 -n%s"
46
48
# define PING_FORMAT "%d bytes from %s icmp_seq=%d. time=%f %s"
47
49
# define PING_PARAMS_5
49
# define PING_PROGRAM_FORMAT "%s ping -c %d -n %s"
51
# define PING_PROGRAM_FORMAT "%s ping %s -n %s"
52
# define PING_PROGRAM_FORMAT_6 "%s ping6 %s -n %s"
50
53
# define PING_FORMAT "%d bytes from %s icmp_seq=%d. time=%f %s"
51
54
# define PING_PARAMS_5