here is a patch to make cf-to-hosts work with multi-homed hosts. It is
not meant to be elegant, so please don't complain. You may need to pipe
its output through uniq.
Piero
--- cf-to-hosts 2000-08-26 21:22:34.000000000 +0200
+++ cf-to-hosts.multihome 2002-12-19 11:38:28.000000000 +0100
@@ -64,7 +64,7 @@
{
foreach my $host (keys %resolved)
{
- print "$resolved{$host}\t$host\n";
+ print "$host\t$resolved{$host}\n";
}
}
@@ -77,11 +77,8 @@
foreach my $host (split (/\s+/, $hosts))
{
- next if (defined $resolved{$host});
-
- my $ip = gethostbyname ($host);
-
- if (!defined ($ip))
+ (my $dummy_name, my $dummy_aliases, my $dummy_addrtype, my $dummy_length, my
+@ips) = gethostbyname ($host) ;
+ if (!defined (@ips))
{
print STDERR "could not look up $host\n";
$err++;
@@ -89,7 +86,11 @@
else
{
- $resolved{$host} = inet_ntoa ($ip);
+ foreach my $one_ip (@ips) {
+ (my $ip_1, my $ip_2, my $ip_3, my $ip_4) = unpack('C4', $one_ip) ;
+ my $the_ip = "$ip_1.$ip_2.$ip_3.$ip_4" ;
+ $resolved{$the_ip} = $host ;
+ }
}
}