56 |
|
|
57 |
exit 0 if (@ARGV == 0); |
exit 0 if (@ARGV == 0); |
58 |
|
|
59 |
open (IN, "$CMD @ARGV 2>&1 |") || |
my @hosts; |
60 |
|
|
61 |
|
# you can use hosts in format host:optional configuration parameters and |
62 |
|
# this part will strip everything after hostname |
63 |
|
foreach (@ARGV) { |
64 |
|
if (m/^[^:]+:?[^\@]*\@([^\/]+)\/?.*/) { |
65 |
|
push @hosts,$1; |
66 |
|
} else { |
67 |
|
push @hosts,$_; |
68 |
|
} |
69 |
|
} |
70 |
|
|
71 |
|
open (IN, "$CMD @hosts 2>&1 |") || |
72 |
die "could not open pipe to fping: $!\n"; |
die "could not open pipe to fping: $!\n"; |
73 |
|
|
74 |
my @unreachable; |
my @unreachable; |
79 |
my @icmp; # ICMP messages output by fping |
my @icmp; # ICMP messages output by fping |
80 |
my %addr_unknown; |
my %addr_unknown; |
81 |
|
|
82 |
my %want_host = map { $_ => 1 } @ARGV; # hosts fping hasn't output yet |
my %want_host = map { $_ => 1 } @hosts; # hosts fping hasn't output yet |
83 |
|
|
84 |
while (<IN>) |
while (<IN>) |
85 |
{ |
{ |