#! /usr/bin/perl
#
# Arguments: 
# GetPraatBinaries.pl [HomeDirectory] 
# 
#
my $Home = shift(@ARGV) || `pwd`;
chomp($Home);

my $Platform = "";
foreach $Platform (mac, linux, hpux, sgi, intelsolaris, solaris, win)
{
    my @URLlist = ();
	open(PLATFORM, "<$Home/download_$Platform.html") || die "<$Home/download_$Platform.html: $!\n";
    while(<PLATFORM>)
    {
        push(@URLlist, $&) if /praat(con)?[\d\.]+_[a-z0-9\_]+\.(tar\.gz|exe|sit)/i;
    };
    close(PLATFORM);
    
    my $File;
    foreach $file (@URLlist)
    {
        `wget -q -O - http://www.fon.hum.uva.nl/praat/$file > $Home/$file\n`;
    }; 
};
