blob: 37adff3577dcbb7a0e15c0526388ab6acb8b91b4 (
plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/usr/bin/perl -w
use strict;
die "$0: EPOCROOT unset\n" unless exists $ENV{EPOCROOT};
die "$0: EPOCROOT directory does exists\n" unless -d $ENV{EPOCROOT};
my $EPOC32 = "$ENV{EPOCROOT}epoc32";
my $EXE = "$EPOC32\\release\\thumb\\urel\\perlapp.app";
my $RSC = "$EPOC32\\data\\z\\system\\apps\\perlapp\\perlapp.rsc";
use Fcntl qw(O_RDONLY);
my %new = ($EXE => 'perlappmin.hex',
$RSC => 'perlrscmin.hex');
for my $fn ($EXE, $RSC) {
if (sysopen(my $fh, $fn, O_RDONLY)) {
my $buffer;
my $size = -s $fn;
my $read;
my $newfn = $new{$fn};
unlink($newfn);
if (($read = sysread($fh, $buffer, $size)) == $size) {
if (open(my $newfh, ">$newfn")) {
binmode($newfh);
print $newfh unpack("H*", $buffer);
close($newfh);
print "Created $newfn\n";
} else {
die qq[$0: open ">$newfn" failed: $!\n];
}
} else {
die qq[$0: sysread $size returned $read\n];
}
close($fh);
} else {
die qq[$0: sysopen "$fn": $!\n];
}
}
|