@rem = 'Perl from *.bat boilerplate @echo off goto endofperl '; $usage =<&STDOUT") || die "Can't dup stdout."; open (OUTLIST, "status -rl |") || die "\"status -rl\" command failed."; while () { chop $_; tr/\\/\//; # Get the path, base name, and version specifier. $file = substr ($_, $cwdlen); ($basename = $file) =~ s:.*/::; system ("catsrc $file >$temp\\$basename"); system ("$diff $temp\\$basename $file"); } close (OUTLIST); } else { # Get the path, base name, and version specifier. ($file = $ARGV[0]) =~ s:\\:/:g; ($basename = $file) =~ s:.*/::; system ("catsrc $file >$temp\\$basename"); system ("$diff $temp\\$basename $file"); } } else { # There are two command-line arguments, so we're doing a diff between two # different historical versions of a file. ($file = $ARGV[0]) =~ s:\\:/:g; $ver1 = $ARGV[1]; $ver2 = $ARGV[2]; ($targ = $file) =~ s:.*/::; $targ = "$temp\\$targ"; # If we're checking a specific version against our current file, then do # a single fetch and compare, else get both versions and compare. if (!($ver1 =~ /^\d*[+-]\d*$/) && ($ver2 eq '')) { printf ("catsrc $file\@v$ver1 >${targ}_$ver1"); printf ("$diff ${targ}_$ver1 $file"); } else { # If version2 is nil, then we must have a version of the form # N1+[N2] or N1-[N2]. if ($ver2 eq '') { if ($ver1 eq '-') { $_ = `log -1 -z $file`; ($xdate,$xuser,$xstat,$xpath,$ver2) = split (); $ver2 =~ s/v//; $ver1 = $ver2 - 1; } elsif ($ver1 =~ /[+-]$/) { $ver2 = eval ("$ver1" . "1"); } else { $ver2 = eval ($ver1); } $ver1 =~ s/[+-].*$//; } if ($ver1 > $ver2) { # Ensure version1 < version2 $temp = $ver1; $ver1 = $ver2; $ver2 = $temp; } system ("catsrc $file\@v$ver1 >${targ}_$ver1"); system ("catsrc $file\@v$ver2 >${targ}_$ver2"); system ("$diff ${targ}_$ver1 ${targ}_$ver2"); } } __END__ :endofperl perl -S %0.bat %1 %2 %3