@REM = ' @echo off c:\perl\perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl '; #!/usr/bin/perl # Fix-wls.pl -- Remove the WatchGuard WLS "signature" from a WLS file and turn it into an EXE #$ver = "v1.0"; # 15-Mar-2000 JPV $ver = "v1.0a"; # 19-Mar-2000 JPV Minor message changes, fixed $0 problem #################################################################################### (($myname = $0) =~ s/^.*\\|\..*$//ig); # remove stuff up to the last "\" and after the "." $Greeting = ("$myname $ver Copyright 2000 JP Vossen (http://www.jpsdomain.org/)\n"); $Greeting .= (" Licensed under the GNU GENERAL PUBLIC LICENSE:\n"); $Greeting .= (" See http://www.gnu.org/copyleft/gpl.html for full text and details.\n"); # Version and copyright info if (("@ARGV" =~ /\?/) || (@ARGV > 5) || (@ARGV < 4)) { #if wrong # of args, or a ? in args - die die ("\n$Greeting\n\tUsage: $myname -i {infile} -o {outfile}\n"); } use Getopt::Std; # User Perl5 built-in program argument handler getopts('i:o:'); # Define possible args. open (INFILE, "$opt_i") || die "$myname: error opening $opt_i $!\n"; open (OUTFILE, ">$opt_o") || die "$myname: error opening $opt_o $!\n"; # Set BIN mode so as to not mangle binary binmode(INFILE); binmode(OUTFILE); print STDERR ("\n$Greeting\n"); # Say hi print STDERR ("\nRemoving WG Signature from $opt_i into $opt_o.\n\n"); # Mention what we're doing # Use the implied Perl default variable ($_) to loop and throw away the WLS header while ( !~ /QXR_END$/) { chomp; } # Use the implied Perl default variable ($_) to loop and re-write the rest of the file into the new file while () { print OUTFILE; } __END__ :endofperl