1995-05-04 03:15:53 -07:00
|
|
|
#!/usr/local/bin/perl
|
|
|
|
|
|
|
|
foreach $f (@ARGV) {
|
|
|
|
open(FILE, $f) || die("Cannot open $f");
|
1998-04-14 07:48:34 -07:00
|
|
|
seek(FILE, -36, 2);
|
|
|
|
$path_size = do read_int();
|
1995-05-04 03:15:53 -07:00
|
|
|
$code_size = do read_int();
|
1997-06-13 08:53:47 -07:00
|
|
|
$prim_size = do read_int();
|
1995-05-04 03:15:53 -07:00
|
|
|
$data_size = do read_int();
|
|
|
|
$symbol_size = do read_int();
|
|
|
|
$debug_size = do read_int();
|
|
|
|
read(FILE, $magic, 12);
|
1998-08-08 03:22:33 -07:00
|
|
|
if ($path_size > 0) {
|
|
|
|
seek(FILE, -($path_size + $code_size + $prim_size + $data_size +
|
|
|
|
$symbol_size + $debug_size + 36), 2);
|
|
|
|
read(FILE, $path, $path_size);
|
|
|
|
} else {
|
|
|
|
$path = "(default runtime)\n";
|
|
|
|
}
|
1995-05-04 03:15:53 -07:00
|
|
|
print $f, ":\n" if ($#ARGV > 0);
|
|
|
|
printf ("\tcode: %d data: %d symbols: %d debug: %d\n",
|
|
|
|
$code_size, $data_size, $symbol_size, $debug_size);
|
1998-04-14 07:48:34 -07:00
|
|
|
printf ("\tmagic number: %s runtime system: %s",
|
|
|
|
$magic, $path);
|
1995-05-04 03:15:53 -07:00
|
|
|
close(FILE);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub read_int {
|
|
|
|
read(FILE, $buff, 4) == 4 || die("Truncated bytecode file $f");
|
|
|
|
@int = unpack("C4", $buff);
|
|
|
|
return ($int[0] << 24) + ($int[1] << 16) + ($int[2] << 8) + $int[3];
|
|
|
|
}
|