1#!/bin/perl 2# ************************************************************* 3# 4# Licensed to the Apache Software Foundation (ASF) under one 5# or more contributor license agreements. See the NOTICE file 6# distributed with this work for additional information 7# regarding copyright ownership. The ASF licenses this file 8# to you under the Apache License, Version 2.0 (the 9# "License"); you may not use this file except in compliance 10# with the License. You may obtain a copy of the License at 11# 12# http://www.apache.org/licenses/LICENSE-2.0 13# 14# Unless required by applicable law or agreed to in writing, 15# software distributed under the License is distributed on an 16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17# KIND, either express or implied. See the License for the 18# specific language governing permissions and limitations 19# under the License. 20# 21# ************************************************************* 22# 23# spose - start pose 24# 25 26use Getopt::Std; 27 28# Location of needed files 29# 30$pose2_exe = $ENV{'POSE2_EXE'}; 31$pose3_exe = $ENV{'POSE3_EXE'}; 32$pose_prc = $ENV{'POSE_PRC'}; 33 34 35if (getopts('23qmwo:r:d:v') != 1) 36{ 37 &usage(); 38} 39 40$apps_load = ""; 41 42if ($opt_q) 43{ 44 &add_app("$pose_prc/Quickword.PRC"); 45} 46if ($opt_m) 47{ 48 &add_app("$pose_prc/MiniCalc.prc"); 49} 50if ($opt_w) 51{ 52 &add_app("$pose_prc/WordSmith.PRC"); 53} 54if ($opt_o) 55{ 56 &add_app("$opt_o"); 57} 58if ($opt_r) 59{ 60 $run_prog .= "-run_app $opt_r"; 61} 62if ($opt_d) 63{ 64 $directory = $opt_d; 65 @files = `/bin/ls -1 $directory/*.pdb`; 66 67 for ($i=0; $i <= $#files; $i++) 68 { 69 $add_file = "$files[$i]"; 70 chomp $add_file; 71 &add_app("$add_file"); 72 } 73} 74 75if ($opt_3) 76{ 77 $pose_exe = $pose3_exe; 78} 79else 80{ 81 $pose_exe = $pose2_exe; 82} 83if ($pose_exe eq "") 84{ 85 print "\nPose not found: Please set \n POSE2_EXE\n or POSE3_EXE\n"; 86 exit 0; 87} 88if ($opt_v) 89{ 90 print ("\n$pose_exe $apps_load $run_prog &\n\n"); 91} 92else 93{ 94 system ("$pose_exe $apps_load $run_prog &"); 95} 96 97exit 0; 98 99sub usage 100{ 101 print "\nUsage: getopt [ -m ] [ -q ] [ -w ] [ -o <PrcFile> ] [ -r <RunProg> ]\n"; 102 print " -2 Runs pose version 3.2 [ current default ]\n"; 103 print " -3 Runs pose version 3.3\n"; 104 print " -d Load all PDB files in specified directory\n"; 105 print " -m Load MiniCalc PRC file\n"; 106 print " -q Load QuickWord PRC file\n"; 107 print " -w Load WordSmith PRC file\n"; 108 print " -o <PrcFile> Other PRC files to load\n"; 109 print " -r <RunProg> Program to run on startup\n"; 110 print " -v Display the command instead of running\n\n"; 111 exit(-1); 112} 113 114sub add_app 115{ 116 my $new_app = $_[0]; 117 118 if ($apps_load ne "") 119 { 120 $apps_load .= ","; 121 } 122 else 123 { 124 $apps_load = "-load_apps "; 125 } 126 127 $apps_load .= "$new_app"; 128} 129