#!/usr/bin/perl -spi
# turn mirror list into http links

BEGIN{
	use FileHandle;
	$f = "<!-- MIRRORSTART -->\n";
	my $MIRRORS = shift;
	if( not $MIRRORS or not $ARGV[0] ){
		print STDERR "use: $0 Mirrorlist Updatefile\n";
		exit 1;
	}
	my($m);
	$m = FileHandle->new("<$MIRRORS") or die "cannot open $MIRRORS";
	while( <$m> ){
		my ($site,$where) = split;
		$f .= <<EOF ;
	<br><a href="$site">$site</a>  $where
EOF
	}
	close($m);
	$f .= "<!-- MIRROREND -->\n";
}

if( /MIRRORSTART/../MIRROREND/ ){
	$_ = "";
	if( !$done ){
		print $f;
		$done = 1;
	}
}
