summaryrefslogtreecommitdiff
path: root/xmerge/source/palmtests/bin/spose
blob: 29f6a9fe52184dc6cb4e7ab4fcc4e394fe1d4e40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/perl
#
# spose - start pose
#

use Getopt::Std;

# Location of needed files
#
$pose2_exe = $ENV{'POSE2_EXE'};
$pose3_exe = $ENV{'POSE3_EXE'};
$pose_prc = $ENV{'POSE_PRC'};


if (getopts('23qmwo:r:d:v') != 1)
{
   &usage();
}

$apps_load = "";

if ($opt_q)
{
   &add_app("$pose_prc/Quickword.PRC");
}
if ($opt_m)
{
   &add_app("$pose_prc/MiniCalc.prc");
}
if ($opt_w)
{
   &add_app("$pose_prc/WordSmith.PRC");
}
if ($opt_o)
{
   &add_app("$opt_o");
}
if ($opt_r)
{
   $run_prog .= "-run_app $opt_r";
}
if ($opt_d)
{
   $directory = $opt_d;
   @files = `/bin/ls -1 $directory/*.pdb`;

   for ($i=0; $i <= $#files; $i++)
   {
      $add_file = "$files[$i]";
      chomp $add_file;
      &add_app("$add_file");
   }
}

if ($opt_3)
{
   $pose_exe = $pose3_exe;
}
else
{
   $pose_exe = $pose2_exe;
}
if ($pose_exe eq "")
{
    print "\nPose not found: Please set \n       POSE2_EXE\n    or POSE3_EXE\n"; 
    exit 0;
}
if ($opt_v)
{
   print ("\n$pose_exe $apps_load $run_prog &\n\n");
}
else
{
   system ("$pose_exe $apps_load $run_prog &");
}

exit 0;

sub usage
{
   print "\nUsage: getopt [ -m ] [ -q ] [ -w ] [ -o <PrcFile> ] [ -r <RunProg> ]\n";
   print " -2            Runs pose version 3.2 [ current default ]\n";
   print " -3            Runs pose version 3.3\n";
   print " -d            Load all PDB files in specified directory\n";
   print " -m            Load MiniCalc PRC file\n";
   print " -q            Load QuickWord PRC file\n";
   print " -w            Load WordSmith PRC file\n";
   print " -o <PrcFile>  Other PRC files to load\n";
   print " -r <RunProg>  Program to run on startup\n";
   print " -v            Display the command instead of running\n\n";
   exit(-1);
}

sub add_app
{
   my $new_app = $_[0];

   if ($apps_load ne "")
   {
      $apps_load .= ",";
   }
   else
   {
      $apps_load = "-load_apps ";
   }

   $apps_load .= "$new_app";
}