Implementing a new compare method

The compare method is invoked by a cleartool diff command. This method does the following operations:
  1. Formats each version using nroff(1), producing an ASCII text file
  2. Compares the formatted versions, using cleardiff or xcleardiff

The file versionvault-home-dir/lib/mgrs/mgr_info.h lists the arguments passed to the method from cleartool or File Browser.

/**********************************************************************
 * compare
 * Compare the data for two or more versions.
 * For more information, see man page for cleartool diff.
 *
 * Command line:
 *  compare [-tiny | -window] [-serial | -diff | -parallel] [-columns n]
 *          [pass-through-options] pname pname ...
******/

This listing shows that a user-supplied implementation of the compare method must accept all the command-line options that the HCL VersionVault diff command supports. The strategy here is to pass the options to cleardiff and not attempt to interpret them. After all options are processed, the remaining arguments specify the files to be compared.

The file versionvault-home-dir/lib/mgrs/mgr_info.sh lists the appropriate exit statuses and provides a symbolic name for the compare method.

# Return Values for COMPARE/MERGE Operations
MGR_COMPARE_NODIFFS=0
MGR_COMPARE_DIFF_OR_ERROR=1
 .
 .
MGR_OP_COMPARE="compare" 

The Bourne shell script listed in Script for compare method implements the compare method. (You can modify this script to implement the xcompare method as a slight variant of compare.)