summaryrefslogtreecommitdiff
path: root/make_as_del.pl
blob: 10ab0715501f8652198770e2e368e6dc009fca71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl

use warnings;
use strict;

my $last_l = 0;

while (<>) {
	chomp;
	s/#.*$//;
	s/^\s+//; s/\s+$//;
	next if /^$/;

	die "format error: $_" if not (/^([\d\.]+)\s+([\d\.]+)\s+([\w\.]+)$/);
	my $f = $1; my $l = $2; my $s = $3;

	die "constraint violated: $l < $last_l" if $l < $last_l;
	$last_l = $l;

	print "{ ${f}, ${l}, \"";
	if ($s =~ /\./) {
		print "$s";
	} else {
		print "whois.$s.net";
	}
	print qq(" },\n);
}