#!/bin/sh -e
MGRDIR=${CLEARCASEHOME:-/opt/hcl/ccm/versionvault}/lib/mgrs
#### read file that defines methods and exit statuses
. $MGR_DIR/mgr_info.sh
#### process all options: pass them through to cleardiff
OPTS=""
while (expr $1 : '\-' > /dev/null) ; do
OPTS="$OPTS $1"
if [ "$1" = "$MGR_FLAG_COLUMNS" ] ; then
shift 1
OPTS="$OPTS $1"
fi
shift 1
done
#### all remaining arguments ($*) are files to be compared
#### first, format each file with NROFF
COUNT=1
TMP=/usr/tmp/compare.$$
for X in $* ; do
nroff -man $X | col | ul -Tcrt > $TMP.$COUNT
COUNT=‘expr $COUNT + 1‘
done
#### then, compare the files with cleardiff
cleardiff -quiet $OPTS $TMP.*
#### cleanup and return appropriate exit status
if [ $? -eq MGR_COMPARE_NODIFFS ] ; then
rm -f $TMP.*
exit MGR_COMPARE_NODIFFS
else
rm -f $TMP.*
exit MGR_COMPARE_DIFF_OR_ERROR
fi