#!/bin/sh

etexi=`find .. -maxdepth 1 -name '*.texi' -print | sort -f | sed -e 's:\.\./::g'`
rtexi=`find . -maxdepth 1 -name '*.texi' -print | sort -f | sed -e 's:\./::g'`

for ef in $etexi ; do
    if [ -f ./$ef ] ; then
	ef_rev=`sed -n -e "/\/$ef\//{s|\/$ef\/\([0-9.]*\)\/.*|\1|p}" ../CVS/Entries`
	rf_rev=`sed -n -e "/OriginalRevision=/{s|.*OriginalRevision=\([0-9.]*\).*|\1|p}" ./$ef`
	if [ "x$ef_rev" = "x$rf_rev" ] ; then
    	    echo "$ef - Translated."
	else
    	    echo "$ef - *** CVS revisions don't match: Translated=$rf_rev Original=$ef_rev"
	    ( cd .. ; cvs diff -u -r $rf_rev -r $ef_rev $ef > ./ru/${ef}_${rf_rev}_${ef_rev}.diff ) 
	fi
    else
	echo "$ef - *** Not translated."
    fi
done

for rf in $rtexi ; do
    if [ ! -f ../$rf ] ; then
        echo "$rf - *** No such file in the Original doc directory."
    fi
done
