From 6e7b55cae05f4babb0050a5796221c9079e8e6e4 Mon Sep 17 00:00:00 2001 From: elliott_c Date: Mon, 5 Apr 2004 15:43:33 +0000 Subject: ChangeLogTag: Mon Apr 5 10:43:03 2004 Chad Elliott --- mwc.pl | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 mwc.pl (limited to 'mwc.pl') 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)); -- cgit v1.2.1