tools: Do not hardcode path to perl.
[dragonfly.git] / tools / tools / locale / tools / changeoffset.pl
CommitLineData
344be199 1#!/usr/bin/env perl -w
252345eb
JM
2
3if ($#ARGV != 2) {
4 print STDERR "Usage: $0 <charmap in> <charmap out> <offset>\n";
5 print STDERR "offset should be in hex and can be prefixed with a -.\n";
6 exit;
7}
8
9$fin = $ARGV[0];
10$fout = $ARGV[1];
11$offset = hex($ARGV[2]);
12
13open(FIN, "$fin.TXT") or die "Cannot open $fin.TXT for reading";
14open(FOUT, ">$fout.TXT");
15
16foreach my $l (<FIN>) {
17 my @a = split(" ", $l);
18
19 if ($a[0] =~ /^0x[0-9a-fA-F]+$/) {
20 my $c = length($a[0]);
21 my $h = hex($a[0]) + $offset;
22
23 $l = sprintf("0x%*X%s", $c - 2, $h, substr($l, $c));
24 }
25
26 print FOUT $l;
27}
28
29close(FOUT);
30close(FIN);