CMP will compare text or binary files (or groups of files) and report any differences. Output is suitable for piping, or processing by other programs. A value returned in ERRORLEVEL lets batch files take action based on whether files are the same or differ.
This document is the complete revision history, starting with the most recent changes. For user instructions, please see the separate user guide.
CMP 5.0 is a complete rewrite of the program from scratch. The program is about 40 pages of code, compared to about 14 pages for the previous release, CMP 4.3! The executables are still comfortably small, about 80 KB for CMP32 and 26 KB for CMP16. If you used CMP 4.x, please see the Transitional Note.
The present release, CMP 4.9, 2001-02-08, is a beta release of 5.0. The only known bug is that under certain circumstances CMP does not resynchronize soon enough. After some difference blocks, you may see one or two identical lines from both files reported. I am of course working to fix that problem.
The new program can handle binary files, can search subdirectories, and makes better use of available memory; details are listed below. The user guide has been very greatly revised and expanded, and this revision history has become a separate document.
Significant enhancements are:
/R
option allows
comparison of binary files.
/S
option compares files
in subdirectory trees.
by the /B
option.
/U
option displays
results in UNIX diff format.
/L
option lets you specify the number of lines necessary to
resynchronize. Formerly hard coded as 1, this now defaults to 2.
(The Transitional Note gives more
information.)
/M
option displays
the massaged lines instead.
/A
option lets you limit
the number of difference blocks reported.
/Q
option now takes a
numeric parameter, for finer control on the quantity of messages.
/D
option now takes an
optional file name for debug information, and the program makes more
information available.
/L
option
and /W
option) have been
increased in CMP16. Previously, the buffer was limited to
65 KB; now it can use all available DOS memory.
If you are upgrading from CMP 4.x, please note that certain options have changed their meanings. This section points them out and tells you how to retain the old behavior if you want to.
Please see What's New in CMP 5 for a number of new options and other enhancements.
/B
, /E
, /T
The /B
option and
the /E
option
now default to the opposite of their old settings.
Formerly, if you did not specify any options, CMP would do some
massaging of the file lines
before comparing. Now, by default CMP compares files character for
character.
If you want the old behavior, you can get it easily. For individual
runs of CMP, specify the
/BE
options on the command line. If you simply want to
restore the old defaults, you can use the
environment variable. Put this command in your
AUTOEXEC.BAT file:
set ORS_CMP=/BEThe
/T
option has been withdrawn. It allowed you to expand
tabs to an equivalent run of spaces, but this was redundant with the
/B
option.
/L
CMP 4.x would consider that files were resynchronized after a difference block as soon as it found a line in file 1 that matched a line in file 2. If you edited every other line of a paragraph or block of code, you would get a lot of little difference blocks.
To avoid this, CMP now requires two consecutive identical lines
before it considers a difference block to have ended. But that will
not be the best choice for every comparison, and you can now use the
/L
option to increase or
decrease that value.
If you want to restore the old behavior, you can use an environment variable. Put this command in your AUTOEXEC.BAT file:
set ORS_CMP=/L,1
Note that comma after the letter L.
/Q
, /QQ
The /Q
option has changed
from a pure toggle to a numeric, /Q0
through
/Q3
. You will still get the old behavior if you type
/Q
or /QQ
.
Because you can combine options, one particular combination has
changed its meaning.
/Q1
or /Q0
used to mean
the /Q
option followed by the
/1
option or the
/0
option; now it means the
/Q
option setting quietness level 1 or 0. To specify
separate options, simply use a slash or hyphen between them, or
specify them in the other order: /Q/1
or /1Q
.
/M
Before release 5.0, CMP would transform ("massage") the input lines to collapse runs of blanks. To conserve computer memory, CMP would store and display only the massaged lines. Then when CMP reported differences, it would display the massaged lines, which would be similar to the lines in the files but not necessarily identical.
Beginning with release 5.0, CMP saves both the massaged and the
original lines, and displays the original lines. If you want to
display the massaged lines, use the
/M
option. If you want
that behavior to be the default, you can use the
environment variable. Put this command in your
AUTOEXEC.BAT file:
set ORS_CMP=/M
This is less of an issue than it was before CMP 5.0. In
earlier releases of CMP, lines were
massaged unless you set options to prevent it. Now, lines are not
massaged unless you set /B
option
or the /I
option. So if you set no
options at all, CMP 5.0 will display difference lines exactly
as they are in the files, which is probbly what you'd expect.
This section is of only historical interest, since the program was completely rewritten in February 2001. But some users have said they find a complete revision history interesting, so here it is.
/Z option
;
updated the logo message to use the URL for Oak Road Systems; expanded
the help message; suggested "cmp /?|more" when the user types
cmp
with no files.
CMP 4.3a, 2000-08-24, updated the user guide but did not change the
program.
It clarified the ERRORLEVEL returns with the
/1
and /0
options when
multiple files are compared.
It also spelled out the limitation that CMP
couldn't be used for binary files; that capability was added in
CMP 5.0.
/F option
,
the /N option
,
and the /QQ option
; sent
the help message to stdout instead
of stderr as previously; reorganized the user guide, adding
many hyperlinks and a few small clarifications.
/I
and
/D
options. Split the
confusing three-valued /B
n option into separate
/B
and
/T
toggle-type options. (The /T
option was
dropped from release 5.0.) Changed the
CMP32 default to /L100
.
Improved
diagnostics for a bad option in the environment variable. Converted
documentation to HTML from Word for Windows.
Two minor releases involved no changes to the program or user guide. Version 4.1a (1999-02-20) updated contact information when we changed Internet providers. Version 4.1b (1999-08-04) updated contact information when we changed physical addresses; it also simplified the registration options and added site license pricing.
CMP 4.0 was packaged on 1998-11-18 as the first shareware release.
/0
and
/1
options; systematized
all return values. Stopped requiring the trailing backslash on a
directory argument. Instead of "effectively identical", reported a more
specific phrase when the files are not significantly different based
on the /B
option and the
/E
option.
/B
option to control that feature and tab expansion.
Added
the /Q
option. Made the format of
command-line options more flexible, and scanned the
ORS_CMP
environment variable for options.
/L
and
/W
.
/L20
(previously /L10
).