#!/usr/bin/perl
# @(#) vergleicht die tpunx/punix mit uunix, upnix, dunix
#
#
#    ========== licence begin  GPL
#    Copyright (C) 2001 SAP AG
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of the GNU General Public License
#    as published by the Free Software Foundation; either version 2
#    of the License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#    ========== licence end
#

use Env;
do "$TOOL/bin/sutvars$TOOLEXT";

chdir($SUT) || die "Can't change to directory $SUT: $!";

my @TFNS = @ARGV;
foreach $TFN ( @TFNS ) {

    print "$TFN\n";
    $OLDPROT=$TFN;
	$TFN =~ s/\.punix//i;

    if ( -f "$TFN.tpunx" ) {
        $OLDPROT="$TFN.tpunx";
	    system("$DIFF $OLDPROT $TFN.punix > diff/$TFN.tpdiff");
        }

    else
        {
        if ( ! -f "$TFN.punix" ) {
		   open(FILE_OUT, ">>$AllSut");
           print FILE_OUT "NOT FOUND: $TFN.punix\n"; close(FILE_OUT);
           print "NOT FOUND: $TFN.punix\n";
           next;
    	   }
         }

    if ( -f "$TFN.uunix" ) {
	    system("$DIFF $OLDPROT $TFN.uunix > diff/$TFN.uudiff");
        }

    if ( -f "$TFN.upnix" ) {
	    system("$DIFF $OLDPROT $TFN.upnix > diff/$TFN.updiff");
        if ( -f "$TFN.uunix" ) {
    	    system("$DIFF $TFN.uunix $TFN.upnix > diff/$TFN.uu_up");
            }
        }

    if ( -f "$TFN.cunix" ) {
	    system("$DIFF $OLDPROT $TFN.cunix > diff/$TFN.cudiff");
        if ( -f "$TFN.uunix" ) {
    	    system("$DIFF $TFN.uunix $TFN.cunix > diff/$TFN.uu_cu");
            }
        }

}

