[Bio] / FigCommon / tool_hdr.pl Repository:
ViewVC logotype

View of /FigCommon/tool_hdr.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Wed Jun 30 18:20:29 2004 UTC (16 years ago) by olson
Branch: MAIN
CVS Tags: merge-trunktag-bobdev_news-2, Root-bobdev_news, merge-bobdev_news-1, merge-trunktag-bobdev_news-1, merge-bodev_news-3, lwc, caBIG-00-00-00, merge-bobdev_news-2, merge-trunktag-bodev_news-3
Branch point for: Branch-bobdev_news
Changes since 1.1: +12 -0 lines
Don't overwrite an existing script.

#
# Create a new fig script.
#

open(FH, "<$FIG_Config::fig_disk/config/fig-user-env.sh");
while (<FH>)
{
    chomp;
    if (/^RTARCH=\"(.*)\"/)
    {
	$arch = $1;
	last;
    }
}

if (!$arch)
{
    die "Couldn't determine FIG architecture name\n";
}

$file = "$FIG_Config::fig_disk/dist/releases/current/$arch/tool_hdr";

open(FH, "<$file") or die "Cannot open tool_hdr file $file: $!\n";

if (@ARGV == 0)
{
    while (<FH>)
    {
	print;
    }
    close(FH);
}
else
{
    $out = $ARGV[0];

    if (-f $out)
    {
	#
	# Better would be to replace the existing tool_hdr, if present,
	# with the right thing. But not yet.
	#
	
	die "Output file $out already exists, not overwriting.\n";
    }
	 
    
    open(OUT, ">$out") or die "Cannot open output $out: $!\n";
    while (<FH>)
    {
	print OUT $_;
    }
    close(FH);
    close(OUT);
    system("chmod +x $out");
}



MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3