summaryrefslogtreecommitdiff
path: root/mwc.pl
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2004-04-05 15:43:33 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2004-04-05 15:43:33 +0000
commit6e7b55cae05f4babb0050a5796221c9079e8e6e4 (patch)
treea4b5566f7629733c7eba7c967ed5601c491a64be /mwc.pl
parent1dd08a7b7175c535fa94f3239927dbb89ba811f6 (diff)
downloadMPC-6e7b55cae05f4babb0050a5796221c9079e8e6e4.tar.gz
ChangeLogTag: Mon Apr 5 10:43:03 2004 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'mwc.pl')
-rwxr-xr-xmwc.pl82
1 files changed, 82 insertions, 0 deletions
diff --git a/mwc.pl b/mwc.pl
new file mode 100755
index 00000000..73d08e40
--- /dev/null
+++ b/mwc.pl
@@ -0,0 +1,82 @@
+eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
+ & eval 'exec perl -w -S $0 $argv:q'
+ if 0;
+
+# ******************************************************************
+# Author: Chad Elliott
+# Date: 6/17/2002
+# $Id$
+# ******************************************************************
+
+# ******************************************************************
+# Pragma Section
+# ******************************************************************
+
+use strict;
+use Cwd;
+use File::Basename;
+
+my($basePath) = getExecutePath($0);
+unshift(@INC, $basePath . '/modules');
+
+require MWC;
+
+# ************************************************************
+# Subroutine Section
+# ************************************************************
+
+sub which {
+ my($prog) = shift;
+ my($exec) = $prog;
+ my($part) = '';
+ my($envSep) = ($^O eq 'MSWin32' ? ';' : ':');
+
+ if (defined $ENV{'PATH'}) {
+ foreach $part (split(/$envSep/, $ENV{'PATH'})) {
+ $part .= "/$prog";
+ if ( -x $part ) {
+ $exec = $part;
+ last;
+ }
+ }
+ }
+
+ return $exec;
+}
+
+
+sub getExecutePath {
+ my($prog) = shift;
+ my($loc) = '';
+
+ if ($prog ne basename($prog)) {
+ if ($prog =~ /^[\/\\]/ ||
+ $prog =~ /^[A-Za-z]:[\/\\]?/) {
+ $loc = dirname($prog);
+ }
+ else {
+ $loc = getcwd() . '/' . dirname($prog);
+ }
+ }
+ else {
+ $loc = dirname(which($prog));
+ }
+
+ if ($loc eq '.') {
+ $loc = getcwd();
+ }
+
+ if ($loc ne '') {
+ $loc .= '/';
+ }
+
+ return $loc;
+}
+
+
+# ************************************************************
+# Main Section
+# ************************************************************
+
+my($driver) = new MWC();
+exit($driver->execute($basePath, basename($0), \@ARGV));