Skip to content

Commit a8fc073

Browse files
committed
Make main script universal
1 parent 76d44f6 commit a8fc073

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

antizapret.pl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@
55

66
$| = 1;
77

8-
my @ips = `fetch -o - https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv | sed 1d | LC_CTYPE=C cut -d ';' -f 1 | tr "\\|" "\\n" | sed 's/^[ \\t]*//;s/[ \\t]*\$//' | sort | uniq`;
8+
my $fetcher = `which fetch curl wget`;
9+
$fetcher =~ s/^(\S+)\s.*$/$1/s;
10+
if ($fetcher =~ /fetch/) {
11+
$fetcher .= ' -o -'
12+
} elsif ($fetcher =~ /curl/) {
13+
# pass
14+
} elsif ($fetcher =~ /wget/) {
15+
$fetcher .= ' -O -'
16+
} else {
17+
die "ERROR: Can't find a program to download data.";
18+
}
19+
20+
my @ips = `$fetcher "https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv" | sed 1d | LC_CTYPE=C cut -d ';' -f 1 | tr "\\|" "\\n" | sed 's/^[ \\t]*//;s/[ \\t]*\$//' | sort | uniq`;
921

1022
my $buf = '';
1123
my $cnt = 0;

0 commit comments

Comments
 (0)