#!/usr/bin/perl

# script to go through resources file 

# (grep "CL_Error: Resource '" log | sort | uniq >resources )

# and generate appropriate xml entries

open (IN, "resources");

while (<IN>) {

	/.*'(.*)'/; $alias_line=$1;
	$alias_line =~ /.*\/(.*)/; $bit=$1;
#	print "alias : $alias_line, bit : $bit \n";
	$found=`locate $bit.png | grep trunk | grep -v "\\.svn"`;
	$found =~ /images\/(.*).png.*/; $found2=$1;
#	print "found $found found2 $found2 \n";
	if (length($found) >2)  { print "<alias name=\"$alias_line\" link=\"$found2\" />\n"; } else {
		# OK, look through global.scr for entry matching $bit
		$found=`grep $bit global.scr`;
		$found =~ /images\/(.*).png.*/; $found2=$1;
		print "global search : $found2";
		if (length($found) >2)  { print "<alias name=\"$alias_line\" link=\"$found2\" />\n"; } 	
			
	}
}
