#!/apps/unsup/IRIX-5.3/bin/perl

open(F, "$ARGV[0]") || die " could not open file $ARGV[0]";

while ( <F> ) {
    if( $_ =~ "Texture2 {" ) { 
	print "	    	DEF textureSwitch Switch {\n";
        print "	    	whichChild  0\n"; 
    }
    elsif( $_ =~ "T.rgb" ) { 
	print "		Texture2 {\n";
	print "                        filename \"./$ARGV[1]T.rgb\"\n";
	print "		}\n";
	print "		Texture2 {\n";
	print "                        filename \"./$ARGV[1]S.rgb\"\n";
	print "		}\n";
	print "		Texture2 {\n";
	print "                        filename \"./$ARGV[1]M.rgb\"\n";
	print "		}\n";
	print "		Texture2 {\n";
	print "                        filename \"./$ARGV[1]A.rgb\"\n";
	print "		}\n";
    }
    else { print $_; }
}
