ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/File-Rdiff/rdiff1
Revision: 1.1
Committed: Thu Mar 21 23:49:01 2002 UTC (22 years, 4 months ago) by root
Branch: MAIN
CVS Tags: rel-1_0, HEAD
Error occurred while calculating annotation data.
Log Message:
*** empty log message ***

File Contents

# Content
1 #!/usr/bin/perl
2
3 # very simple program that mimics librsync's rdiff, using the
4 # simple file utility functions. see rdiff2 for the same program,
5 # written using the nonblocking API
6
7 use File::Rdiff qw(:trace :file);
8
9 trace_level(LOG_INFO);
10
11 if ($ARGV[0] eq "signature") {
12 open $base, "<$ARGV[1]" or die "$ARGV[1]: $!";
13 open $sig, ">$ARGV[2]" or die "$ARGV[2]: $!";
14
15 File::Rdiff::sig_file $base, $sig;
16 } elsif ($ARGV[0] eq "delta") {
17 open $sig, "<$ARGV[1]" or die "$ARGV[1]: $!";
18 open $new, "<$ARGV[2]" or die "$ARGV[2]: $!";
19 open $delta, ">$ARGV[3]" or die "$ARGV[3]: $!";
20
21 $sig = loadsig_file $sig;
22
23 ref $sig or exit 1;
24
25 $sig->build_hash_table;
26
27 File::Rdiff::delta_file $sig, $new, $delta;
28 } elsif ($ARGV[0] eq "patch") {
29 open $base, "<$ARGV[1]" or die "$ARGV[1]: $!";
30 open $delta, "<$ARGV[2]" or die "$ARGV[2]: $!";
31 open $new, ">$ARGV[3]" or die "$ARGV[3]: $!";
32
33 File::Rdiff::patch_file $base, $delta, $new;
34 } else {
35 print <<EOF;
36 $0 signature BASE SIGNATURE
37 $0 delta SIGNATURE NEW DELTA
38 $0 patch BASE DELTA NEW
39 EOF
40 exit (1);
41 }
42