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-*- # (I'm a Emacsian Fundamentalist) # $Id: //guest/richard_geiger/utils/cvs2p4/MANIFEST#1 $ # # Copyright (c) 1996 Network Appliance, Inc. # # You may distribute under the terms of the Artistic License, as # specified in the README file included in the cvs2p4 # distribution. # # Original Author: Richard Geiger for Network Appliance, Inc. # # $Id: //guest/richard_geiger/utils/cvs2p4/MANIFEST#1 $ # Here is the manifest. # You can update the checksums with "-gen" # require 5.000; use Carp; $| = 1; ($Myname = $0) =~ s%^.*/%%; $Mydirname = &dirname($0); chdir $Mydirname || die; #path sum1 sum2 opts $manifest = <] LIT sub x { my ($cmd) = @_; print "$Myname: $cmd\n"; if (! $noexec) { $status = system $cmd; if ($status) { printf "$Myname: *** exit status %d\n", $status / 256; exit 1; } } } sub dirname { my ($dir) = @_; $dir =~ s%^$%.%; $dir = "$dir/"; if ($dir =~ m%^/[^/]*//*$%) { return "/"; } if ($dir =~ m%^.*[^/]//*[^/][^/]*//*$%) { $dir =~ s%^(.*[^/])//*[^/][^/]*//*$%$1%; { return $dir; } } return "."; } sub usage { print STDERR $Usage; exit 1; } sub help { print STDERR <= 0) { if ($ARGV[0] eq "-gen") { $op = "gen"; shift; next; } elsif ($ARGV[0] eq "-tar") { $op = "tar"; shift; if ($#ARGV < 0) { usage; } $vers = $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 != -1) { &usage; } if ($op eq "gen") { @mestat = stat($Myname); if (! open(ME, "<$Myname")) { print "Can't open myself for modification: $!\n"; exit 1; } if (! open(NEWME, ">$Myname.gen")) { print "Can't open myself for modification: $!\n"; exit 1; } while () { print NEWME; if (/^\$manifest = <) { if (/^MANIFEST$/) { print NEWME; last; }} while () { print NEWME; } close NEWME; unlink "$Myname.old"; rename "$Myname", "$Myname.old" || die; rename "$Myname.gen", "$Myname" || die; chmod $mestat[2], "$Myname" || die; } elsif ($op eq "tar") { $Here = `/bin/pwd`; chop $Here; ($Herename = $Here) =~ s%^.*/%%; $Parent = &dirname($Here); &x("/bin/mv $Parent/$Herename $Parent/cvs2p4-$vers"); chdir $Parent || die; &x("$tarcmd") &x("/bin/mv $Parent/cvs2p4-$vers $Parent/$Herename"); chdir $Here || die; foreach $path (keys(%owners)) { $own = $owners{$path}; $grp = $groups{$path}; chown ($own, $grp, "$path") || print STDERR "WARNING: can't \"chown $own, $grp, $path\": $!\n"; } } print "\n"; if ($status == 0) { print "All ok\n"; } if ($status & 1) { print "*** some files are missing\n"; } if ($status & 2) { print "*** some files have been modified\n"; } exit $status;