CMP — Compare Text or Binary Files
Revision History for Release 5.23
Program Dated 16 Jan 2006 / This Document Dated 16 Jan 2006
Copyright © 1994–2006 Stan Brown, Oak Road Systems
Program Dated 16 Jan 2006 / This Document Dated 16 Jan 2006
Copyright © 1994–2006 Stan Brown, Oak Road Systems
Summary: This document is the complete revision history, starting with the most recent changes. To use CMP, please see the separate user guide.
Previously, paths were limited to 259 bytes, a Windows limit as far as I could determine. In tests with Windows XP Pro SP2, I am still unable to create longer usable paths. However, one customer reported having paths longer than that, presumably created by some application program. Now, CMP allocates path strings dynamically according to their actual length.
CMP 5.21 and CMP 5.22 were private releases to the customer who reported the bug.
Program changes:
Documentation changes:
Changes to the demo, file demo\demo.bat:
This is a minor release. By user request, "file not found" messages (/C option) are now written to both standard output and standard error, if you redirected standard output to a report file. Also by user request, when you append debug output to an existing file, a prominent header separates new output from previous output. Other minor improvements to debug output include a clearer list of filespec arguments, for help in diagnosing possible user errors on the command line.
This is a minor release. It adds one feature: when comparing multiple files, CMP now tells you at the end how many pairs were the same, how many pairs were different, and how many sought files were missing.
One line of the help message was 82 characters long; now it isn't.
This is a very minor release, for one new feature: CMP now tells you not only how many blocks of lines were different between the two files, but also how many actual lines were different.
new feature:
The /C option makes CMP warn you about missing files. (Previously, a small subset of warnings appeared by default and could be turned off with the /Q3 option, but there was no way to get warnings for most missing files without weeding through the large output of the /D option.)
The old behavior was equivalent to /C0 with the /S option and /C1 without the /S option.
bugs fixed:
When the first filespec contained a wild card, and the first physical entry in the directory was a subdirectory that matched the wild card, CMP might not find all files that actually matched.
(CMP16 only) When the first filespec was a directory, CMP16 ignored files with an extension (that is, the program expanded dir\* instead of dir\*.*). This did not affect CMP32.
When a line was added or deleted at end of file, and UNIX output was selected, the line number displayed for the other file was off by 1.
CMP 5.0 was 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, under 90 KB for CMP32 and 60 KB for CMP16.
If you used CMP 4.3 or earlier, please see the Transitional Note below.
The new program can handle binary files, can search subdirectories, displays results in your choice of formats, 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. A demo has been added to display some of CMP's features.
New options:
Old options enhanced:
Other enhancements:
If you are upgrading from CMP 4.3 or earlier, 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.
If you use the ORS_CMP environment variable to store options, make sure to check it and see whether you need to make changes.
Please see What's New in CMP 5 for a number of new options and other enhancements.
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=/BE
In this case, you may want to consider the new /M option as well.
The /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.
CMP 4.3 and earlier 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. Though that will usually give a more usable report that the old default, it's not be the best choice for every comparison. You can now use the /L option to increase or decrease that value. This flexibility should let you get much better difference reports for many sets of files.
If you want to restore the old behavior as the default, 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.
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 /Q1 or /Q0 option to set quietness level to 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.
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 the /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 probably 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.
This was a beta release version of 5.0. Between this and the final release, a number of improvements were made, including some new features, and a few bugs were fixed. Full details were in the cmpbeta5.htm file distributed with release 5.0.
Added the /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, 24 Aug 2000, updated the user guide but did not change the program. It clarified the values you can check with if errorlevel after running CMP with the /0 or /1 option to compare multiple files. It also spelled out the limitation that CMP couldn't be used for binary files; that capability was added in CMP 5.0.
Added the /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.
Added the /I option and / option. Split the confusing three-valued /Bn option into separate /B option and /T toggle-type options. (The /T option was dropped from release 5.0.) Changed the CMP32 default to /L100 option. 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, 20 Feb 1999, updated contact information when Oak Road Systems changed Internet providers. Version 4.1b, 4 Aug 1999, updated contact information when we changed physical addresses; it also simplified the registration options and added site license pricing.
Allowed multiple filespecs before a directory name, not just one filespec with wild cards. Supported long filenames in the new 32-bit version.
CMP 4.0 was packaged on 18 Nov 1998 for the first shareware release.
Added the /0 option and /1 option; 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.
Compressed sequences of spaces and tabs to a single space; added the /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.
Allocated string arrays far, allowing larger combined values of the /L option and the /W option.
Defaulted to /L20 (previously /L10).
Expanded tabs in input lines to the appropriate number of spaces.
Allowed wild cards in the first file argument.
Initial release (private releases, to clients only, until 4.0)