2 # converttags - a perl script to coonvert some predefined tags
3 # to user specified values
5 # Copyright (c) 2000 Sun Microsystems, Inc.
10 die "No parameters were specified.\nperl converttags.pl <mode> <title> <productname> [<color1>] [<color2>] file_1 [... file_n]\n";
14 die "No file were specified -> no file must be converted!\n";
18 # = 2 -> exit without conversion
22 $productname = shift @ARGV;
27 if( $mode =~ s/2/$1/go )
32 if( $ARGV[0] =~ s/(#[\w]{6})/$1/go )
34 $color1 = shift @ARGV;
36 if( $ARGV[0] =~ s/(#[\w]{6})/$1/go )
38 $color2 = shift @ARGV;
42 print "$productname\n";
52 print "convert tags: $ARGV ";
54 open ( FILEIN
, $ARGV ) || die "could not open $ARGV for reading";
57 open( FILEOUT
, ">$ARGV.tmp" ) || die "could not open $ARGV.tmp for writing";
63 if ( $lineCount == 10 )
69 s
#\[TITLE\]#$title#go;
71 # change [PRODUCTNAME] tag
72 s
#\[PRODUCTNAME\]#$productname#go;
74 # change color #003399 to #$color1 if color1 was specified!
75 if ( ! "$color1" eq "" )
80 # change color #99CCFF to #$color2 if color2 was specified!
81 if ( ! "$color2" eq "" )
91 rename "$ARGV.tmp", $ARGV || die "could not rename $ARGV.tmp to $ARGV";