<commit_before>#!/usr/bin/perl
# File ecmd_setup.pl created by <NAME>,6A5244 at 13:50:19 on Fri May 13 2005. 

# Why wouldn't you use strict???
use strict;
use Cwd 'chdir';
##########################################################################
# Figure out where the user is calling this script from
#

# return value
my $rc = 0;


# Meghna needs me to save away the directory the script was called from, I'll do that here
my $callingPwd;
#Commenting this since this seems to be resolving the links in the path
#chomp($callingPwd = `pwd`);
#This seems to keep the directory intact. Tested in ksh, Jason will test in csh
chomp($callingPwd = `cd .;pwd`);
# Now do the rest
my $pwd;
my @tempArr = split(/\/+/,$0);
pop(@tempArr); # The script name
$" = "/"; # Make it so the array below seperates on / instead of space
#If it starts with a ., it's being called with relative path
if (substr($0,0,1) ne "/") {
  $pwd = $callingPwd;  # Get where I got called from
  $pwd = $pwd . "/" . "@tempArr";  # Now use the relative to find out where the script is 
} else { # Absolute path
  $pwd = "@temp<PASSWORD>";
}
$" = " "; # Reset
chomp($pwd = `cd $pwd;pwd`);  # Get to where this script resides

# installpath points to root of install
my $installPath = $pwd;
$installPath =~ s/\/([^\/..]*\/?)$/\//;

# This is a slick bit of trickeration if I may say so myself.
# We have to change to the directory the script is in for the module requires below
# This will enable the modules to be found in the local directory in the @INC
chdir "$pwd";

#########################################
# Setup the modules to include
# Base support, always there
require ecmdsetup;
my $ecmd = new ecmdsetup();

# Create the other setup objects based upon what is available
my ($cro, $scand, $gip, $mbo);
# Cronus
my $croUse = 0;
if (-e "crosetup.pm") {
  $croUse = 1;
  require crosetup;
  $cro = new crosetup();
}

# Scand
my $scandUse = 0;
if (-e "scandsetup.pm") {
  $scandUse = 1;
  require scandsetup;
  $scand = new scandsetup();
}

# GFW I/P
my $gipUse = 0;
if (-e "gipsetup.pm") {
  $gipUse = 1;
  require gipsetup;
  $gip = new gipsetup();
}

# Mambo
my $mboUse = 0;
if (-e "mbosetup.pm") {
  $mboUse = 1;
  require mbosetup;
  $mbo = new mbosetup();
}

##########################################################################
#  Variables
#
my %modified;  # 0 is no change, 1 set needed, -1 unset needed 
my $release;
my $prevRelease;
my $plugin;
my $product;
my $temp;
my $shortcut = 0;
my $localInstall = 1;  # Assume it's a local install and then disprove it by comparing ctepaths to CTEPATH
my $copyLocal = 0;  # Does the user want ECMD_EXE and ECMD_DLL_FILE copied to /tmp and run from there?
my $cleanup = 0;  # Call only cleanup on the plugins to remove anything they might have put out there.
# These ctepaths are in regular expression format for the search below.
# This allows the user to put just rchland or rchland.ibm.com, etc..
my @ctepaths = ("/afs/rchland(|\.ibm\.com)/rel/common/cte",
                "/afs/awd(|\.austin\.ibm\.com)/projects/cte",
                "/afs/austin(|\.ibm\.com)/projects/cte",
                "/afs/apd(|\.pok\.ibm\.com)/func/vlsi/cte",
                "/afs/(bb|(vlsilab(|\.boeblingen\.ibm\.com)))/proj/cte",
                "/afs/btv(|\.ibm\.com)/data/vlsi/cte",
                "/afs/raleigh(|\.ibm\.com)/cadtools/cte",
                "/afs/watson(|\.ibm\.com)/projects/vlsi/cte");

#####################################################
# Call the main function, then add the rc from that to the output
#
$rc = main();
printf("return $rc;");
exit($rc);

sub main {
  #####################################################
  # Look to see if help was requested
  #
  if ("@ARGV" =~ /-h/) {
    help();
    if ($croUse) { $cro->help(); }
    return 1;
  }

  ##########################################################################
  # If the user isn't setup for CTE, let's do it for them.
  #
  #if ($ENV{"CTEPATH"} eq "") {
  #  @tempArr = split(/\//,$pwd);
  #  # Blow off the first 4 entries that are ecmd dirs
  #  pop(@tempArr); # bin
  #  pop(@tempArr); # release
  #  pop(@tempArr); # ecmd
  #  pop(@tempArr); # tools
  #  $" = "/"; # Make it so the array below seperates on / instead of space
  #  $ENV{"CTEPATH"} = "@tempArr";
  #  $" = " "; # Reset
  #  #Finally, mark it modified
  #  $modified{"CTEPATH"} = 1;
  #  printf("echo CTEPATH unset! Setting to %s;\n",$ENV{"CTEPATH"});
  #}

  ##########################################################################
  # Figure out if the user is on a local copy of CTE
  #
  for (my $x = 0; $x <= $#ctepaths && $localInstall != 0; $x++) {
    if ($ENV{"CTEPATH"} =~ m!${ctepaths[$x]}!) {
      $localInstall = 0;
    }
  }

  ##########################################################################
  # Get the users shell
  #
  my $shell = shift(@ARGV);

  # If you add a shell here, you need to update the output printing below
  if ($shell eq "ksh") {
  } elsif ($shell eq "csh") {
  } else {
    printf("echo Your shell is unsupported\\!;");
    return 1;
  }

  ##########################################################################
  # Get the release
  #

  # Save the previous release the user may have had
  $prevRelease = $ENV{"ECMD_RELEASE"};
<commit_msg>Updated to get around csh problem<commit_after>#!/usr/bin/perl
# File ecmd_setup.pl created by <NAME>,6A5244 at 13:50:19 on Fri May 13 2005. 

# Why wouldn't you use strict???
use strict;
use Cwd 'chdir';
##########################################################################
# Figure out where the user is calling this script from
#

# return value
my $rc = 0;


# Meghna needs me to save away the directory the script was called from, I'll do that here
my $callingPwd;
#Commenting this since this seems to be resolving the links in the path
#chomp($callingPwd = `pwd`);
#This seems to keep the directory intact. Tested in ksh, Jason will test in csh
chomp($callingPwd = `cd .;pwd`);
# Now do the rest
my $pwd;
my @tempArr = split(/\/+/,$0);
pop(@tempArr); # The script name
$" = "/"; # Make it so the array below seperates on / instead of space
#If it starts with a ., it's being called with relative path
if (substr($0,0,1) ne "/") {
  $pwd = $callingPwd;  # Get where I got called from
  $pwd = $pwd . "/" . "@tempArr";  # Now use the relative to find out where the script is 
} else { # Absolute path
  $pwd = "@<PASSWORD>";
}
$" = " "; # Reset
chomp($pwd = `cd $pwd;pwd`);  # Get to where this script resides

# installpath points to root of install
my $installPath = $pwd;
$installPath =~ s/\/([^\/..]*\/?)$/\//;

# This is a slick bit of trickeration if I may say so myself.
# We have to change to the directory the script is in for the module requires below
# This will enable the modules to be found in the local directory in the @INC
chdir "$pwd";

#########################################
# Setup the modules to include
# Base support, always there
require ecmdsetup;
my $ecmd = new ecmdsetup();

# Create the other setup objects based upon what is available
my ($cro, $scand, $gip, $mbo);
# Cronus
my $croUse = 0;
if (-e "crosetup.pm") {
  $croUse = 1;
  require crosetup;
  $cro = new crosetup();
}

# Scand
my $scandUse = 0;
if (-e "scandsetup.pm") {
  $scandUse = 1;
  require scandsetup;
  $scand = new scandsetup();
}

# GFW I/P
my $gipUse = 0;
if (-e "gipsetup.pm") {
  $gipUse = 1;
  require gipsetup;
  $gip = new gipsetup();
}

# Mambo
my $mboUse = 0;
if (-e "mbosetup.pm") {
  $mboUse = 1;
  require mbosetup;
  $mbo = new mbosetup();
}

##########################################################################
#  Variables
#
my %modified;  # 0 is no change, 1 set needed, -1 unset needed
my $shell;
my $release;
my $prevRelease;
my $plugin;
my $product;
my $temp;
my $shortcut = 0;
my $localInstall = 1;  # Assume it's a local install and then disprove it by comparing ctepaths to CTEPATH
my $copyLocal = 0;  # Does the user want ECMD_EXE and ECMD_DLL_FILE copied to /tmp and run from there?
my $cleanup = 0;  # Call only cleanup on the plugins to remove anything they might have put out there.
# These ctepaths are in regular expression format for the search below.
# This allows the user to put just rchland or rchland.ibm.com, etc..
my @ctepaths = ("/afs/rchland(|\.ibm\.com)/rel/common/cte",
                "/afs/awd(|\.austin\.ibm\.com)/projects/cte",
                "/afs/austin(|\.ibm\.com)/projects/cte",
                "/afs/apd(|\.pok\.ibm\.com)/func/vlsi/cte",
                "/afs/(bb|(vlsilab(|\.boeblingen\.ibm\.com)))/proj/cte",
                "/afs/btv(|\.ibm\.com)/data/vlsi/cte",
                "/afs/raleigh(|\.ibm\.com)/cadtools/cte",
                "/afs/watson(|\.ibm\.com)/projects/vlsi/cte");

#####################################################
# Call the main function, then add the rc from that to the output
#
$rc = main();
# Yet again, csh sucks and doesn't have a return value.  They will have to go without
if ($shell eq "ksh") {
  printf("return $rc;");
}
exit($rc);

sub main {
  #####################################################
  # Look to see if help was requested
  #
  if ("@ARGV" =~ /-h/) {
    help();
    if ($croUse) { $cro->help(); }
    return 1;
  }

  ##########################################################################
  # If the user isn't setup for CTE, let's do it for them.
  #
  #if ($ENV{"CTEPATH"} eq "") {
  #  @tempArr = split(/\//,$pwd);
  #  # Blow off the first 4 entries that are ecmd dirs
  #  pop(@tempArr); # bin
  #  pop(@tempArr); # release
  #  pop(@tempArr); # ecmd
  #  pop(@tempArr); # tools
  #  $" = "/"; # Make it so the array below seperates on / instead of space
  #  $ENV{"CTEPATH"} = "@tempArr";
  #  $" = " "; # Reset
  #  #Finally, mark it modified
  #  $modified{"CTEPATH"} = 1;
  #  printf("echo CTEPATH unset! Setting to %s;\n",$ENV{"CTEPATH"});
  #}

  ##########################################################################
  # Figure out if the user is on a local copy of CTE
  #
  for (my $x = 0; $x <= $#ctepaths && $localInstall != 0; $x++) {
    if ($ENV{"CTEPATH"} =~ m!${ctepaths[$x]}!) {
      $localInstall = 0;
    }
  }

  ##########################################################################
  # Get the users shell
  #
  $shell = shift(@ARGV);

  # If you add a shell here, you need to update the output printing below
  if ($shell eq "ksh") {
  } elsif ($shell eq "csh") {
  } else {
    printf("echo Your shell is unsupported\\!;");
    return 1;
  }

  ##########################################################################
  # Get the release
  #

  # Save the previous release the user may have had
  $prevRelease = $ENV{"ECMD_RELEASE"};

{'fraction_non_alphanumeric': 0.2473753280839895, 'fraction_numerical': 0.008248968878890138, 'mean_word_length': 3.392342527789214, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3692463', 'n_tokens_mistral': 3754, 'n_tokens_neox': 3540, 'n_words': 1212}