Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save earnhardt3rd/2b8803d5222bde4bd4ed7ec47d6c6a03 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 = &_SIG();}
1;
sub _SIG {
&_EXIT_CLEAN("SIG INT CAUGHT!");
}
sub buildManualWinFiles {
my $line = $_[0];
print " W:$line\n" if $DEBUG > 0;
my $to = $line;
$to =~ s/NXROOT//g;
$to =~ s/^\\//;
$to =~ s/^\///;
$to =~ s/\\/_-_/g;
$to =~ s/\//_-_/g;
$to = "\%COMPUTERNAME\%\\$to";
$line =~ s/NXROOT/\%NXROOT\%/;
my $get = "copy \"$line\" \"${to}\"";
my $put = "copy \"$to\" \"$line\"";
open (GT,">> $gwFile");
print " gw: $get\n" if $DEBUG > 0;
print GT "$get\n";
close(GT);
open (GT,">> $pwFile");
print " gp: $put\n" if $DEBUG > 0;
print GT "$put\n";
close(GT);
}
sub buildManualUnixFiles {
my $line = $_[0];
$line =~ s/\\/\//g;
print " U:$line\n" if $DEBUG > 0;
my $to = $line;
$to =~ s/NXROOT//g;
$to =~ s/^\\//;
$to =~ s/^\///;
$to =~ s/\\/_-_/g;
$to =~ s/\//_-_/g;
$to = "\$HOST/$to";
$line =~ s/NXROOT/\$ROOTS{"NXROOT"}/;
my $get = $OS_TOOLS{"cp"} . " \"$line\" \"${to}\"";
my $put = $OS_TOOLS{"cp"} . " \"$to\" \"$line\"";
open (GT,">> $guFile");
print " gu: $get\n" if $DEBUG > 0;
print GT "$get\n";
close(GT);
open (GT,">> $puFile");
print " pu: $put\n" if $DEBUG > 0;
print GT "$put\n";
close(GT);
}
sub _LOAD_DDICT {
if (exists($APPS{"USD"})) {
if (-d $APPS{"USD"}) {
my $dFile = $APPS{"USD"} . $SLASH . "site" . $SLASH . "ddict.sch";
if (-f $dFile) {
open(DFH,"< $dFile");
my $sectionFlag="";
while (<DFH>) {
my $line = $_;
chomp($line);
next if ($line =~ /#/);
next if ($line eq "");
print " DDICT_LINE:$line\n";
}
close(DFH);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment