merge the formfield patch from ooo-build
[ooovba.git] / xmerge / source / palmtests / bin / spose
blob29f6a9fe52184dc6cb4e7ab4fcc4e394fe1d4e40
1 #!/bin/perl
3 # spose - start pose
6 use Getopt::Std;
8 # Location of needed files
10 $pose2_exe = $ENV{'POSE2_EXE'};
11 $pose3_exe = $ENV{'POSE3_EXE'};
12 $pose_prc = $ENV{'POSE_PRC'};
15 if (getopts('23qmwo:r:d:v') != 1)
17 &usage();
20 $apps_load = "";
22 if ($opt_q)
24 &add_app("$pose_prc/Quickword.PRC");
26 if ($opt_m)
28 &add_app("$pose_prc/MiniCalc.prc");
30 if ($opt_w)
32 &add_app("$pose_prc/WordSmith.PRC");
34 if ($opt_o)
36 &add_app("$opt_o");
38 if ($opt_r)
40 $run_prog .= "-run_app $opt_r";
42 if ($opt_d)
44 $directory = $opt_d;
45 @files = `/bin/ls -1 $directory/*.pdb`;
47 for ($i=0; $i <= $#files; $i++)
49 $add_file = "$files[$i]";
50 chomp $add_file;
51 &add_app("$add_file");
55 if ($opt_3)
57 $pose_exe = $pose3_exe;
59 else
61 $pose_exe = $pose2_exe;
63 if ($pose_exe eq "")
65 print "\nPose not found: Please set \n POSE2_EXE\n or POSE3_EXE\n";
66 exit 0;
68 if ($opt_v)
70 print ("\n$pose_exe $apps_load $run_prog &\n\n");
72 else
74 system ("$pose_exe $apps_load $run_prog &");
77 exit 0;
79 sub usage
81 print "\nUsage: getopt [ -m ] [ -q ] [ -w ] [ -o <PrcFile> ] [ -r <RunProg> ]\n";
82 print " -2 Runs pose version 3.2 [ current default ]\n";
83 print " -3 Runs pose version 3.3\n";
84 print " -d Load all PDB files in specified directory\n";
85 print " -m Load MiniCalc PRC file\n";
86 print " -q Load QuickWord PRC file\n";
87 print " -w Load WordSmith PRC file\n";
88 print " -o <PrcFile> Other PRC files to load\n";
89 print " -r <RunProg> Program to run on startup\n";
90 print " -v Display the command instead of running\n\n";
91 exit(-1);
94 sub add_app
96 my $new_app = $_[0];
98 if ($apps_load ne "")
100 $apps_load .= ",";
102 else
104 $apps_load = "-load_apps ";
107 $apps_load .= "$new_app";