#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
    if $running_under_some_shell;
			# this emulates #! processing on NIH machines.
			# (remove #! line above if indigestible)

eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
			# process any FOO=bar switches

$[ = 1;			# set array base to 1
$, = ' ';		# set output field separator
$\ = "\n";		# set output record separator

while (<>) {
    chomp;	# strip record separator
    @Fld = split(' ', $_, -1);

    while ($Fld[1] ne '<dirname>') {
	;
    }
    $S = $Fld[2];
    $fname = $Fld[2] . '/Txt';
    system("/bin/rm filename.txt");
    system("cat \"\" > filename.txt");
    open FILE, ">", "filename.txt" or die $!;

    while (1) {
	$done = 0;
	while (!$done) {
	    if ($Fld[1] eq '<dirname>') {
		$done = 1;
		$S = $Fld[2];
		$fname = $Fld[2] . '/Txt';
    		system("/bin/rm filename.txt");
    		system("cat \"\" > filename.txt");
    		open FILE, ">", "filename.txt" or die $!;
	    }
	    else {
		print FILE $_;
	    }
	}
	$str = 'diff filename.txt ' . $fname;
	print $str;
	system($str);
    }
}
