Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


*** empty log message ***
[palacios-OLD.git] / palacios / scripts / scan
1 #! /usr/bin/perl
2
3 # Scan a file for a 32-bit word with a particular value.
4 # $Revision: 1.1 $
5
6 use strict qw(refs vars);
7 use FileHandle;
8
9 my $filename = shift @ARGV;
10 my $word_value = shift @ARGV;
11
12 ((defined $filename) && (defined $word_value))
13     || die "Usage: scan <filename> <word value in hex>\n";
14
15 my $fh = new FileHandle("<$filename");
16 my $val = hex($word_value);
17
18 my $buf = ' ' x 4;
19
20 my $offset = 0;
21 while ( read( $fh, $buf, 4) == 4 ) {
22     my $out = unpack "V", $buf;
23     if ( $out == $val ) {
24         print "Found value $word_value at offset $offset\n";
25         exit;
26     }
27     $offset += 4;
28 }
29 print "Didn't find value $word_value\n";