#!/usr/bin/perl
#Kyoma TAKAHASHI 1999.08.11
#                1999.09.09
#                1999.11.09

#      list-2-tcp file

$add = ':allow,RELAYCLIENT=""';
$bottom = '127.';

$rulefile = shift;

open(RULEFILE,"> $rulefile");

while(<>) {
        chop($ip = $_);
        if($ip ne '') {
        if(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/) {
                ($_) = /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/;
                s/^0+//;
                s/\.0+/\./g;
                s/^\./0\./;
                s/\.$/\.0/;
                s/\.\./\.0\./g; s/\.\./\.0\./g;
                print RULEFILE $_,$add,"\n";
        }}
}

print RULEFILE $bottom,$add;

close(RULEFILE);


