summaryrefslogtreecommitdiff
path: root/make_as32_del.pl
blob: 638267944e270776a567c5be3badcd2facfa6963 (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
#!/usr/bin/perl

use warnings;
use strict;

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

	my ($fh, $fl, $lh, $ll, $s, $f, $l);
	if (($fh, $fl, $lh, $ll, $s) =
			/^(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+([\w\.-]+)$/) {
		$f = ($fh << 16) + $fl;
		$l = ($lh << 16) + $ll;

		my $server = ($s =~ /\./) ? $s : "whois.$s.net";
		print qq|{ ${f}u, ${l}u,\t"$server" },\t/* $fh.$fl $lh.$ll */\n|;
	} elsif (($f, $l, $s) = /^(\d+)\s+(\d+)\s+([\w\.-]+)$/) {
		my $server = ($s =~ /\./) ? $s : "whois.$s.net";
		print qq|{ ${f}u, ${l}u,\t"$server" },\n|;
	} else {
		die "format error: $_";
	}
}