X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=geekos%2Fscripts%2Fpw;fp=geekos%2Fscripts%2Fpw;h=7edc728dcdad4efe1ec9fc09a16a6fd43933ac71;hp=0000000000000000000000000000000000000000;hb=ddc16b0737cf58f7aa90a69c6652cdf4090aec51;hpb=626595465a2c6987606a6bc697df65130ad8c2d3 diff --git a/geekos/scripts/pw b/geekos/scripts/pw new file mode 100755 index 0000000..7edc728 --- /dev/null +++ b/geekos/scripts/pw @@ -0,0 +1,24 @@ +#! /usr/bin/perl + +# Inspect a 32 word at a specified offset in a file. +# $Revision: 1.1 $ + +use strict qw(refs vars); +use FileHandle; + +my $filename = shift @ARGV; +my $offset = shift @ARGV; + +((defined $filename) && (defined $offset)) + || die "Usage: pw \n"; + +my $fh = new FileHandle("<$filename"); +printf( "%08x\n", ReadWord($fh, $offset) ); + +sub ReadWord { + my ($fh, $offset) = @_; + seek $fh, $offset, SEEK_SET; + my $buf = 'X' x 4; + read $fh, $buf, 4; + return unpack('V',$buf); +}