mirror of
https://github.com/rfc1036/whois.git
synced 2026-05-03 06:51:09 +00:00
make_ip_del_recovered.pl: refactoring
This commit is contained in:
parent
36720ed8e6
commit
c4b9cf8c23
@ -17,15 +17,16 @@ open(my $out, '>', 'ip_del_recovered.h');
|
||||
while (my $row = $csv->getline($in)) {
|
||||
next if $row->[0] eq 'Start address';
|
||||
next if $row->[5] ne 'ALLOCATED';
|
||||
my ($first_ip, $last_ip, undef, undef, $server) = @$row;
|
||||
|
||||
print $out '/* ' . $row->[0] . ' - ' . $row->[1] . " */\n";
|
||||
print $out "/* $first_ip - $last_ip */\n";
|
||||
my @networks =
|
||||
map { Net::IP->new($_) }
|
||||
Net::CIDR::range2cidr($row->[0] . '-' . $row->[1]);
|
||||
Net::CIDR::range2cidr($first_ip . '-' . $last_ip);
|
||||
print $out sprintf(qq|{ %sUL, %sUL, "%s" },\n|,
|
||||
$_->intip,
|
||||
((~(0xffffffff >> $_->prefixlen)) & 0xffffffff),
|
||||
$row->[4]
|
||||
$server
|
||||
) foreach @networks;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user