#!/usr/bin/perl -w
#-- -*-perl-*-
my $dir=$ARGV[0];
if (!$dir) {
  print STDERR "Usage: $0 _ship_directory_\n";
  exit(1);
}elsif ($dir!~m+/$+) {
	$dir.='/';
}    
opendir(DIR,$dir) or die $!;
my @files=readdir(DIR);
closedir(DIR);
my @html=grep /html$/, @files;
my @ps=grep /ps$/, @files;
my @dirs=sort grep /^(A|P|I|S)/, @files;
foreach my $basin (@dirs) {
	my $new_dir="$dir$basin";
	my $basin_html="$basin.html";
	my $basin_ps="$basin.ps";
	my $target_ps="../$ps[0]";
	my $target_html="../$html[0]";
	my $command="cd $new_dir ; pwd ; ln -s $target_ps $basin_ps ;";
	$command.=" ln -s $target_html $basin_html";
	my @res=`$command`;
	print @res;
}

