ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/arch/dev/scripts/update_shield.pl
Revision: 1.1
Committed: Mon Feb 6 20:26:11 2006 UTC (18 years, 5 months ago) by root
Content type: text/plain
Branch point for: UPSTREAM, MAIN
Log Message:
Initial revision

File Contents

# Content
1 #!/usr/bin/perl
2
3 for ($i=0; $i<=$#ARGV; $i++) {
4 $changed = 0;
5 open(IN,"<$ARGV[$i]");
6 open(OUT,">$ARGV[$i].new");
7 while (<IN>) {
8 $in = $_;
9 if (/^can_use_armour (.*)$/) {
10 print OUT "can_use_shield $1\n";
11 $changed = 1;
12 }
13 print OUT $in;
14 }
15 close(OUT);
16 close(IN);
17 if (! $changed) {
18 unlink("$ARGV[$i].new");
19 # print "$ARGV[$i] unchanged\n";
20 } else {
21 print "$ARGV[$i] updated\n";
22 unlink("$ARGV[$i]");
23 if (!rename("$ARGV[$i].new", "$ARGV[$i]")) {
24 print STDERR "Unable to rename file $ARGV[$i]\n";
25 }
26 }
27 }