eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # THE PRECEEDING STUFF EXECS perl via $PATH # -*-Fundamental-*- # $Id: //guest/perforce_software/archived/utils/cvs2p4/bin/revmap#1 $ # # Richard Geiger # require 5.000; #use bytes; use Carp; # ...or flounder. (This will fail unless 'perl' is a perl5!) $| = 1; ($Myname = $0) =~ s%^.*/%%; $Usage = <] LIT sub usage { print STDERR $Usage; exit 1; } sub help { print STDERR <= 0) { if ($ARGV[0] eq "-boolopt") { $Boolopt = 1; shift; next; } elsif ($ARGV[0] eq "-map") { shift; if ($ARGV[0] < 0) { &usage; } $Mapfile = $ARGV[0]; shift; next; } elsif ($ARGV[0] eq "-help") { &help; } elsif ($ARGV[0] =~ /^-/) { &usage; } if ($Args ne "") { $Args .= " "; } push(@Args, $ARGV[0]); shift; } if ($#Args ne 0) { &usage; } $Convdir = $Args[0]; chdir $Convdir || die "$Myname: can't chdir \"$Convdir\": $!"; $Convdir = `/bin/pwd`; chop $Convdir; chdir $Here || die "$Myname: can't chdir \"$Here\": $!"; $Revmap = "$Convdir/$Mapfile"; use DB_File; $DBMCLASS="DB_File"; #$myhashinfo = new DB_File::HASHINFO; #$myhashinfo->{bsize} = 4096; $myhashinfo = new DB_File::BTREEINFO; if (! tie(%REVMAP, $DBMCLASS, $Revmap, O_RDONLY, 0444, $myhashinfo)) { print "$Myname: can't tie \"$Revmap\": $!\n"; exit 1; } while (($key,$val) = each %REVMAP) { if ($Mapfile != "rrevmap") { $val =~ s/\001.*//; } print "$key $val\n"; } untie %REVMAP;