#!/usr/bin/perl -w
#
# getfile1vars
# this utility does much the same work as build-opt-env.pl
# in manipulating the object, but in this case, the object
# is not available in the environment
#
# calling routine includes build-opt-env.pl
# with a require
#
# 21 Jul 16. WJS
# Parametrize build-opt-env.pl and require it instead of do ing it
# 3 Jun 05. WJS
# Looks like $subsels and $dispss need defn in some cases. While
# doing that, redo $param1 stuff - maybe even correctly!
# 16 Mar 05. WJS
# Hardcode perl location - obviates need for template file
#
$build_opt_env = 'build-opt-env.pl';
require $build_opt_env;
$mainlocation = "$ENV{'USETEMPDIR'}"."/";
#
# open the file JGTEMP/port_no/remote_host/join-object-1
#
$objnamefile="$mainlocation"."join-object-1";
open(OBJ,"$objnamefile") || die "Cannot open object $!
\n";
while () {
$object1 = $_;
}
chomp($object1);
close(OBJ);
$dispobj=$object1;
#print STDERR $object1," at 1\n";
#
# remove file extension from object 1 - anything beyond final '.'
#
if (rindex($object1,".") > rindex($object1,"/")) {
$dispobj=substr($object1,0,rindex($object1,"."));
}
#
# open the file USETEMPDIR/parameters, containing
# the subselections active, if any, for object 1
# Note that we are 'positive reporting' here, expecting
# to see 'none' if there are no subselections active.
# See '/jg/putjoinenv' for code to create these files
#
$paramfile="$mainlocation"."parameters";
open(IN,"$paramfile") || die "Cannot open parameters $!\n";
while () {
$param1 = $_;
}
chomp($param1);
close(IN);
#print STDERR "at 2: ",$param1,"\n";
if ($param1 eq "none") {
$subsels = $dispss = "";
} else {
$subsels = $dispss = $param1;
($param1 =~ /[&;]/) && ($subsels=`$topdir/bin/htmlunesc "$param1"`);
($subsels =~ /[<>]/) && ($dispss=`$topdir/bin/htmlesc "$subsels"`);
$dispss=`$topdir/bin/trigram_util -un "$dispss"`;
}
#
# open the file USETEMPDIR/from_loc, containing
# the referring URL, probably optserv1's Plotting and OO menu
#
$from_location="$mainlocation"."from_loc";
open(IN,"$from_location") || die "Cannot open fromlocation $!\n";
while () {
$refloc = $_;
}
close(IN);
chomp($refloc);