Subversion Repositories gelsvn

Rev

Rev 107 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
107 bj 1
eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
2
    & eval 'exec perl -w -S $0 $argv:q'
3
    if 0;
4
 
5
# ******************************************************************
6
#      Author: Chad Elliott
7
#        Date: 6/17/2002
8
#         $Id: mpc.pl 107 2005-09-02 16:42:23Z bj $
9
# ******************************************************************
10
 
11
# ******************************************************************
12
# Pragma Section
13
# ******************************************************************
14
 
15
use strict;
16
use Cwd;
17
use Config;
18
use File::Basename;
19
 
20
my($basePath) = getExecutePath($0);
21
unshift(@INC, $basePath . '/modules');
22
 
23
require MPC;
24
 
25
# ************************************************************
26
# Subroutine Section
27
# ************************************************************
28
 
29
sub getBasePath {
30
  return $basePath;
31
}
32
 
33
 
34
sub which {
35
  my($prog) = shift;
36
  my($exec) = $prog;
37
 
38
  if (defined $ENV{'PATH'}) {
39
    my($part)   = '';
40
    my($envSep) = $Config{'path_sep'};
41
    foreach $part (split(/$envSep/, $ENV{'PATH'})) {
42
      $part .= "/$prog";
43
      if ( -x $part ) {
44
        $exec = $part;
45
        last;
46
      }
47
    }
48
  }
49
 
50
  return $exec;
51
}
52
 
53
 
54
sub getExecutePath {
55
  my($prog) = shift;
56
  my($loc)  = '';
57
 
58
  if ($prog ne basename($prog)) {
59
    if ($prog =~ /^[\/\\]/ ||
60
        $prog =~ /^[A-Za-z]:[\/\\]?/) {
61
      $loc = dirname($prog);
62
    }
63
    else {
64
      $loc = getcwd() . '/' . dirname($prog);
65
    }
66
  }
67
  else {
68
    $loc = dirname(which($prog));
69
  }
70
 
71
  if ($loc eq '.') {
72
    $loc = getcwd();
73
  }
74
 
75
  if ($loc ne '') {
76
    $loc .= '/';
77
  }
78
 
79
  return $loc;
80
}
81
 
82
 
83
# ************************************************************
84
# Main Section
85
# ************************************************************
86
 
87
my($driver) = new MPC();
88
exit($driver->execute($basePath, basename($0), \@ARGV));