File: fixbitmaps.pl

package info (click to toggle)
oneko 1.2.sakura.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,664 kB
  • ctags: 238
  • sloc: ansic: 1,269; makefile: 43; perl: 25
file content (26 lines) | stat: -rwxr-xr-x 737 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/contributed/bin/perl
foreach $elem( @ARGV) {
    if ($elem =~ /\.xbm$/io) {
	rename ($elem, $elem . '.bak');
	open (OUTFILE, ">$elem");
	$oldfile = $elem . '.bak';
	open (INFILE, $oldfile);
	print "Working on $elem\n";
	@data = <INFILE>;
	$name = $elem;
	$name =~ s/\.xbm$//;
	@parts = split(/\//,$name);
	$count = @parts;
	$name = @parts[$count - 1];
	print "name = $name count = $count\n";
	foreach $line (@data) {
	    $line =~ s/ \S*width/' ' . $name . '_width'/e;
	    $line =~ s/ \S*height/' ' . $name . '_height'/e;
	    $line =~ s/ \S*x_hot/' ' . $name . '_x_hot'/e;
	    $line =~ s/ \S*y_hot/' ' . $name . '_y_hot'/e;
	    $line =~ s/ \S*bits/' ' . $name . '_bits'/e;
	}
	print OUTFILE @data;
	unlink ($oldfile);
    }
}