home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 6 File
/
06-File.zip
/
gdiff.zip
/
gdiff.doc
next >
Wrap
Text File
|
1999-11-22
|
6KB
|
179 lines
21 November 1999.
GDIFF: compute the difference between two files
Abstract:
GDIFF is an OS/2 program that will compute differences between 2 files,
and save the results to a "GDIFF formatted" difference file.
GDIFF can also "undifference" a "new" file, given an "original" file and
a GDIFF formatted difference file.
GDIFF will work on any type of file, it is NOT limited to text files.
-------------------
Installation:
Just copy GDIFF.EXE to your path (say, to x:\OS2\APPS, where x:
is your boot drive). GDIFF.EXE does not require EMX!
-------------------
Syntax:
The basic syntax is:
x:>GDIFF oldfile newfile diff_file
diff_File will be created, and will contain the "GDIFF formatted"
differences between oldfile and newfile.
Example:
x:>GDIFF version1.doc version2.doc version2.dif
To recreate newfile from oldfile and diff_file, and save the results
to newfile_dup, use:
x:>GDIFF oldfile diff_file newfile_dup
Example:
x:>GDIFF -u version1.doc version2.dif version2.new
The more complete syntax is:
Syntax:
x:>GDiff oldfile newfile [out_file] [-options]
If out_file is not specified, output is written to stdout
GDIFF recognizes the following options. Please note that options
may appear anywhere (they do not have to be after the filenames),
and that there should be no spaces between the - and the option:
-MD4 -- just compute an MD4 of oldfile and newfile (or just
the oldfile).
example: x:>GDIFF -md4 bigprog.exe
-u -- undifference. Newfile should be a Gdiff difference file.
Note that GDIFF can be used with ANY "Gdiff formatted"
difference file, not just difference files computed by
this version of GDIFF.
-b=nnn -- use a blocksize of nnn (0<nnn<2000, 0=program chooses).
Smaller blocksizes will lead to smaller difference files,
but tend to increase execution time.
By default, the program will choose a blocksize (based on the
size of the input files).
-q -- quiet (suppress status messages)
Error messages will NOT be suppressed. Error messages always
start with "ERROR" (not including the quotes).
-v -- verify
Verify that the difference file will create a duplicate of
the "newfile". Note that a temporary file (on your TEMP
directory) will be created during this comparison, and
deleted afterwards.
To use -v, you must specify an "out_file".
When undifferencing, -v is ignored.
-version -- version
Write version info to stdout (a one line message)
-------------------
Examples:
x:>GDIFF -v bigdoc.new bigdoc.old bigdoc.dif
x:>GDIFF -u bigdoc.new bigdoc.dif > bigdoc.nu2
x:>GDIFFF bigdoc.old bigdoc.new bigdoc.df2 -b=200
x:>GDIFF -u -q bigdoc.new bigdoc.df2 bigdoc.nu3
x:>GDIFF -md4 bigdoc.new bigdoc.nu3
Notes:
* GDiff uses the RSYNC algorithim to compute differences.
It is possible, though VERY unlikely, for the RSYNC algorithim
to produce an incorrect difference file. For circumstances where a
microscopic chance of failure is important, we recommend using
the -v option.
* Specification of the GDIFF "difference file" format can be found at:
http://www.w3.org/TR/NOTE-gdiff-19970901.html
* Information on the Rsync algorithim can be found at
http://www.samba.org/rsync/
* GDIFF has been tested on a two versions of a 36M file (same contents,
but with contents rearranged). It took about a minute (on a Pentium 333).
* GDIFF does not work well with compressed files (such as .ZIP files) --
these tend to change globally even if only a small set of the
archived files are different.
* GDIFF.FOR contains the GDIFF source code (Fortran 77+, compiled with
Watcom 11.0b).
* REXX callable GDIFF procedures can be found in the rxRsync
package (http://www.srehttp.org/apps/rxrsync/).
---------------------
Error codes:
On successful completion, GDIFF will set a completion code, with
values:
0 - success
1 - failed to specify input file
2 - problem computing md4 (oldfile)
3 - problem computing md4 (newfile)
4 - bad -blocksize option
5 - verification requires an output file
31 - could not open old file
32 - problem rewinding old file
33 - old file is empty
34 - unable to read entire oldfile into memory
35 - unable to allocate memory while creating synopsis
36 - verification failure
37 - unable to open temporary file
41 - problem allocating memory to create diff file
42 - problem opening newfile
43 - internal write problem
46 - error writing to ouptut file
47 - problem allocating memory to read newfile
48 - problem reading newfile (possibly eof)
49 - unable to open output file
51 - unable to open "difference file"
52 - not a gdiff formatted difference file
53 - unable to read from difference file
54 - unimplemented "large move" gdiff command encountered
55 - error in ungdiff procedure
56 - illegal gdiff code
For example, you could use a REXX call of:
oldfile='old_version_of_a_file' /*
newfile='new_version_of_a_file'
dif_file='difference_file_to_create'
address cmd 'GDIFF -1 'oldfile' 'newfile' 'dif_file
if rc<>0 then say "GDIFF failue with code= 'rc
---------------------
Disclaimer:
This is freeware that is to be used at your own risk -- the
author and any potentially affiliated institutions disclaim all
responsibilties for any consequence arising from the use, misuse, or abuse
of this software (or pieces of this software).
You may use this (or subsets of this) program as you see fit,
including for commercial purposes; so long as proper attribution
is made, and so long as such use does not in any way preclude
others from making use of this code.
Contact:
Daniel Hellerstein (danielh@crosslink.net or danielh@econ.ag.gov)