159 lines
4.7 KiB
Perl
Executable File
159 lines
4.7 KiB
Perl
Executable File
#!/usr/sbin/perl
|
|
|
|
#**************************************************************************
|
|
#* *
|
|
#* Copyright (c) 1996 Silicon Graphics, Inc. *
|
|
#* All Rights Reserved *
|
|
#* *
|
|
#* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI *
|
|
#* *
|
|
#* The copyright notice above does not evidence any actual of intended *
|
|
#* publication of such source code, and is an unpublished work by Silicon *
|
|
#* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is *
|
|
#* the property of Silicon Graphics, Inc. Any use, duplication or *
|
|
#* disclosure not specifically authorized by Silicon Graphics is strictly *
|
|
#* prohibited. *
|
|
#* *
|
|
#* RESTRICTED RIGHTS LEGEND: *
|
|
#* *
|
|
#* Use, duplication or disclosure by the Government is subject to *
|
|
#* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in *
|
|
#* Technical Data and Computer Software clause at DFARS 52.227-7013, *
|
|
#* and/or in similar or successor clauses in the FAR, DOD or NASA FAR *
|
|
#* Supplement. Unpublished - rights reserved under the Copyright Laws of *
|
|
#* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N. *
|
|
#* Shoreline Blvd., Mountain View, CA 94039-7311 *
|
|
#**************************************************************************
|
|
|
|
# DEMO_tree.pl
|
|
#
|
|
# Routines to add or edit demos
|
|
|
|
1; # return true
|
|
|
|
sub Is_Multiple_Trees {
|
|
local(@trees);
|
|
@trees = &List_Tree_Names;
|
|
return($#trees);
|
|
}
|
|
|
|
|
|
sub List_Tree_Names {
|
|
local(@names, $name);
|
|
open(NAMESPACE, "$FILE_TREES_NAMESPACE") || &Print_Error("$ERROR_NO_OPEN", "$FILE_TREES_NAMESPACE", "$STATUS_SERIOUS");
|
|
while (<NAMESPACE>) {
|
|
chop;
|
|
($name,$file) = /(.*)$TREES_DELIM.*$TREES_DELIM(.*)/;
|
|
push(@names, $name) if ($name);
|
|
}
|
|
close(NAMESPACE);
|
|
return(&alpha(@names));
|
|
}
|
|
|
|
sub Demos_In_Tree {
|
|
local($tree_name, $tree_file, @demos);
|
|
$tree_name = $_[0];
|
|
$tree_file = &Tree_File_From_Name("$tree_name");
|
|
open(TREEFILE, "$PATH_TREES_DIR/$tree_file");
|
|
while (<TREEFILE>) {
|
|
chop;
|
|
push(@demos, $_) if ($_);
|
|
}
|
|
close(TREEFILE);
|
|
return(@demos);
|
|
}
|
|
|
|
# Creates as %demo_list
|
|
sub Assoc_Demos_In_All_Trees {
|
|
local($tree_name, $tree_file, @demos);
|
|
open(LISTFILE, "$FILE_DEMOLIST");
|
|
while (<LISTFILE>) {
|
|
chop;
|
|
($demo_name, $tree_name) = /(.*)$TREES_DELIM(.*)/;
|
|
if ("$demo_name" ne "" && "$tree_name" ne "") {
|
|
$demo_list{$demo_name} = $tree_name;
|
|
}
|
|
}
|
|
close(LISTFILE);
|
|
}
|
|
|
|
sub Demos_In_All_Trees {
|
|
local($tree_name, $tree_file, @demos);
|
|
open(LISTFILE, "$FILE_DEMOLIST");
|
|
while (<LISTFILE>) {
|
|
chop;
|
|
push(@demos, "$_") if ($_);
|
|
}
|
|
close(LISTFILE);
|
|
return(&alpha(@demos));
|
|
}
|
|
|
|
sub Is_Demo_In_Tree {
|
|
local($demo_name, $demo_tree, $file_name);
|
|
$demo_name = shift;
|
|
$demo_tree = shift;
|
|
$file_name = &Tree_File_From_Name("$demo_tree");
|
|
open(TREEFILE, "$PATH_TREES_DIR/$file_name");
|
|
while(<TREEFILE>) {
|
|
chop;
|
|
return(1) if ("$_" eq "$demo_name");
|
|
}
|
|
return(0);
|
|
}
|
|
|
|
|
|
sub Tree_File_From_Name {
|
|
open(NAMESPACE, "$FILE_TREES_NAMESPACE") || &Print_Error("$ERROR_NO_OPEN", "$FILE_TREES_NAMESPACE", "$STATUS_SERIOUS");
|
|
while (<NAMESPACE>) {
|
|
chop;
|
|
($name,$file) = /(.*)$TREES_DELIM.*$TREES_DELIM(.*)/;
|
|
if ("$name" eq "$_[0]") {
|
|
close(NAMESPACE);
|
|
return("$file");
|
|
}
|
|
}
|
|
close(NAMESPACE);
|
|
&Print_Error("$ERROR_DB", "Name- \'$_[0]\'", "$STATUS_SERIOUS");
|
|
return(0);
|
|
}
|
|
|
|
|
|
sub Tree_Path_From_Name {
|
|
local($name, $path);
|
|
open(NAMESPACE, "$FILE_TREES_NAMESPACE") || &Print_Error("$ERROR_NO_OPEN", "$FILE_TREES_NAMESPACE", "$STATUS_SERIOUS");
|
|
while (<NAMESPACE>) {
|
|
chop;
|
|
($name,$path) = /(.*)$TREES_DELIM(.*)$TREES_DELIM.*/;
|
|
if ("$name" eq "$_[0]") {
|
|
close(NAMESPACE);
|
|
return($path);
|
|
}
|
|
}
|
|
close(NAMESPACE);
|
|
&Print_Error("$ERROR_DB", "Name- \'$_[0]\'", "$STATUS_SERIOUS");
|
|
return(0);
|
|
}
|
|
|
|
sub Tree_Name_From_Path {
|
|
local($name, $path);
|
|
open(NAMESPACE, "$FILE_TREES_NAMESPACE") || &Print_Error("$ERROR_NO_OPEN", "$FILE_TREES_NAMESPACE", "$STATUS_SERIOUS");
|
|
while (<NAMESPACE>) {
|
|
chop;
|
|
($name,$path) = /(.*)$TREES_DELIM(.*)$TREES_DELIM.*/;
|
|
if ("$path" eq "$_[0]") {
|
|
close(NAMESPACE);
|
|
return($name);
|
|
}
|
|
}
|
|
close(NAMESPACE);
|
|
if (!$_[1]) { # Check for query override
|
|
&Print_Error("$ERROR_DB", "Path- \'$_[0]\'", "$STATUS_SERIOUS");
|
|
return(0);
|
|
} else {
|
|
return("");
|
|
}
|
|
}
|
|
|
|
|
|
|