File: updatehtmlmirrors

package info (click to toggle)
ifhp 3.5.20-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,424 kB
  • sloc: ansic: 15,055; sh: 12,037; perl: 1,461; makefile: 643; sed: 16
file content (30 lines) | stat: -rw-r--r-- 552 bytes parent folder | download | duplicates (11)
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
29
30
#!/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;
	}
}