Skip to content

Instantly share code, notes, and snippets.

@earnhardt3rd
Created June 19, 2023 14:03
Show Gist options
  • Select an option

  • Save earnhardt3rd/e3ddefc9390cc28951e3fca10b5373f9 to your computer and use it in GitHub Desktop.

Select an option

Save earnhardt3rd/e3ddefc9390cc28951e3fca10b5373f9 to your computer and use it in GitHub Desktop.
require 'getopts.pl';
Getopts('m:d:t');
my $MODE = uc($opt_m) || "";
my $DEBUG = $opt_d || 0;
if (defined $opt_t) { my %TEST = &_SHOW_HISTORY();}
1;
sub _SHOW_HISTORY {
my @HISTORY;
print " SEARCHING FOR HISTORY FILES!\n";
if (scalar(keys %ROOTS) > 0) {
foreach my $rKey(sort keys %ROOTS) {
next if ($rKey =~ /^${HAG}/);
my $rPath = $ROOTS{$rKey};
print " ROOT_KEY :$rKey\n" if $DEBUG > 0;
print " ROOT_PATH:$rPath\n" if $DEBUG > 0;
if (-d $rPath) {
opendir(HISFLD,$rPath);
my @HISFILES = grep { /\.his$|\.HIS$/ } readdir(HISFLD);
closedir(HISFLD);
chdir "$rPath";
if (scalar(@HISFILES) > 0) {
print " FOUND HISTORY FILE IN FOLDER: $rPath\n";
for my $hisFile(@HISFILES) {
if (-f $hisFile) {
print " READING *** $hisFile ***\n";
open (HIS,"< $hisFile");
while (<HIS>) {
my $line = $_;
chomp($line);
if ($line =~ /PTF Wizard/) {
print " ::$line\n";
my $hLine = $rPath . $SLASH . $hisFile . ",${line}";
push(@HISTORY,"$hLine");
}
}
my $fxHis = $rPath . $SLASH . $hisFile;
my $nxHis = $PDM . $SLASH . "his" . $SLASH . &_PATH_STRING($fxHis);
if (-f $nxHis) {
my $hisDifCmd = $OS_TOOLS{"diff"} . " \"$fxHis\" \"$nxHis\"";
my $xhDIF = `$hisDifCmd 2>&1`;
if ($xhDIF =~ /Usage:/) {
print " ***********************************\n";
print " ERROR!Unable to complete diff\n";
print " $hisDifCmd\n";
print " $xhDIF\n";
print "SKIP...\n";
next;
}
if ($xhDIF eq "") {
print " ** NO DIFFERENCES **\n";
next;
} else {
my $hCmd = $OS_TOOLS{"cp"} . " \"$fxHis\" \"$nxHis\"";
my $hEx = `$hCmd`;
if (! -f $nxHis ) {
print " ** COPY FAILED **\n";
print " $hCmd\n";
}
}
} else {
my $hCmd = $OS_TOOLS{"cp"} . " \"$fxHis\" \"$nxHis\"";
my $hEx = `$hCmd`;
if (! -f $nxHis ) {
print " ** COPY FAILED **\n";
print " $hCmd\n";
}
}
} else {
print " NOT A VALID FILE: $hisFile\n";
}
}
} else {
print " NO HISTORY FILES IN FOLDER: $rPath\n";
}
} else {
print " INVALID PATH! Could not locate Folder ( $rKey==$ROOTS{$rKey} )\n";
}
}
} else {
&displayMessageInBox(" NO ROOT TAGS FOUND!\n");
#print " NO ROOT ENVIRONMENT TAGS FOUND!\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment