X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fcreate_prefix.pl;h=60d7d2a1f462861d60868da871dacf37b6bdaaec;hb=4f1c00b0c181d994b13bb9b0ff9ea03ee0cf120c;hp=daf4a09e409171cb1433b068aa9aa9a8c1d218c6;hpb=d1daa87473f824fcae5751e2576c31265bf53544;p=spider.git diff --git a/perl/create_prefix.pl b/perl/create_prefix.pl index daf4a09e..60d7d2a1 100755 --- a/perl/create_prefix.pl +++ b/perl/create_prefix.pl @@ -20,6 +20,7 @@ BEGIN { unshift @INC, "$root/local"; } +use DXVars; use SysVar; use Data::Dumper; @@ -33,18 +34,22 @@ my %locn = (); # the inverse of the above my %pre = (); # the prefix hash my %pren = (); # the inverse -if (@ARGV && $ARVG[0] =~ /^--system$/) { +my $prefix; + +if (@ARGV && $ARGV[0] =~ /^--system$/) { $prefix = $main::data; shift; } else { - $prefix = $main:local_data; + $prefix = $main::local_data; } -# open the input file -my $ifn = $ARGV[0] if $ARGV[0]; +my $ifn; -$ifn = "$prefix/wpxloc.raw" if !$ifn; -open (IN, $ifn) or die "can't open $ifn ($!)"; +$ifn = "$prefix/wpxloc.raw"; +unless (open (IN, $ifn)) { + $ifn = "$main::data/wpxloc.raw"; + open(IN, $ifn) or die "can't open $ifn ($!)"; +} # first pass, find all the 'master' location records while () { @@ -104,10 +109,17 @@ close(IN); #print Data::Dumper->Dump([\%pre, \%locn], [qw(pre locn)]); # now open the cty.dat file if it is there +my $r; +$ifn = "$prefix/cty.dat"; +unless ($r = open (IN, $ifn)) { + $ifn = "$main::data/cty.dat"; + $r = open(IN, $ifn); +} + my @f; my @a; $line = 0; -if (open(IN, "$prefix/cty.dat")) { +if ($r) { my $state = 0; while () { $line++;